Add examples for configs

Signed-off-by: Misty Stanley-Jones <misty@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 473a9d20cd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Misty Stanley-Jones 2018-01-31 11:06:52 -08:00 committed by Sebastiaan van Stijn
parent 528b959ebc
commit be60297514
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 33 additions and 4 deletions

View File

@ -200,12 +200,41 @@ $ docker service create --name redis \
To grant a service access to multiple secrets, use multiple `--secret` flags.
Secrets are located in `/run/secrets` in the container. If no target is
specified, the name of the secret will be used as the in memory file in the
container. If a target is specified, that will be the filename. In the
example above, two files will be created: `/run/secrets/ssh` and
Secrets are located in `/run/secrets` in the container if no target is specified.
If no target is specified, the name of the secret is used as the in memory file
in the container. If a target is specified, that is used as the filename. In the
example above, two files are created: `/run/secrets/ssh` and
`/run/secrets/app` for each of the secret targets specified.
### Create a service with configs
Use the `--config` flag to give a container access to a
[config](config_create.md).
Create a service with a config. The config will be mounted into `redis-config`,
be owned by the user who runs the command inside the container (often `root`),
and have file mode `0444` or world-readable. You can specify the `uid` and `gid`
as numerical IDs or names. When using names, the provided group/user names must
pre-exist in the container. The `mode` is specified as a 4-number sequence such
as `0755`.
```bash
$ docker service create --name=redis --config redis-conf redis:3.0.6
```
Create a service with a config and specify the target location and file mode:
```bash
$ docker service create --name redis \
--config source=redis-conf,target=/etc/redis/redis.conf,mode=0400 redis:3.0.6
```
To grant a service access to multiple configs, use multiple `--config` flags.
Configs are located in `/` in the container if no target is specified. If no
target is specified, the name of the config is used as the name of the file in
the container. If a target is specified, that is used as the filename.
### Create a service with a rolling update policy
```bash