Download the PHP package glen/docker-secrets-provider without Composer
On this page you can find all versions of the php package glen/docker-secrets-provider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download glen/docker-secrets-provider
More information about glen/docker-secrets-provider
Files in glen/docker-secrets-provider
Package docker-secrets-provider
Short Description Pimple Docker Secrets ServiceProvider
License MIT
Informations about the package docker-secrets-provider
DockerSecretsProvider
DockerSecretsProvider
is a Pimple to manage sensitive data with Docker secrets,
mostly useful for Silex based applications.
Docker 1.13 provides secrets in swarm mode.
You can use secrets to manage any sensitive data which a Docker container needs at runtime but you don't want to store in the image or in source control, such as:
- Usernames and passwords
- TLS certificates and keys
- SSH keys
- Other important data such as the name of a database or internal server
- Generic strings or binary content (up to 500 kb in size)
Usage
Create the secret, using docker
CLI
Note the -n
parameter with echo; this is necessary to suppress the trailing newline character. If you don't do this, your value is not correctly encoded.
Mount it into container, this example is for docker-compose
or docker stack deploy
In development mode, you may use file:
directive to use secrets without swarm:
Require the library
Map the secret in Pimple container
This would make $app['my.secret']
read as "This is a secret"
In case of nested structure ($app['option']['key']
),
the value can be callback, to allow assigning value to sub-keys.
Here's example using saxulum/saxulum-doctrine-mongodb-odm-provider:
To avoid Indirect modification of overloaded element
,
the value needs to be made copy and assigned again: