Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 0056d8c

Browse files
Merge pull request #2315 from thaJeztah/19.03_backport_carry_855_config_opts
[19.03 backport] Add examples for configs Upstream-commit: e1c31c891088b96a8bb35183711e721fd8bc441d Component: cli
2 parents 9e55c7c + c3831ce commit 0056d8c

2 files changed

Lines changed: 34 additions & 5 deletions

File tree

components/cli/docs/reference/commandline/run.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ using IPv4 or IPv6 networking in your containers. Use the following
689689
flags for IPv4 address retrieval for a network device named `eth0`:
690690

691691
```bash
692-
$ HOSTIP=`ip -4 addr show scope global dev eth0 | grep inet | awk '{print \$2}' | cut -d / -f 1`
692+
$ HOSTIP=`ip -4 addr show scope global dev eth0 | grep inet | awk '{print $2}' | cut -d / -f 1 | sed -n 1p`
693693
$ docker run --add-host=docker:${HOSTIP} --rm -it debian
694694
```
695695

components/cli/docs/reference/commandline/service_create.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,41 @@ $ docker service create --name redis \
200200

201201
To grant a service access to multiple secrets, use multiple `--secret` flags.
202202

203-
Secrets are located in `/run/secrets` in the container. If no target is
204-
specified, the name of the secret will be used as the in memory file in the
205-
container. If a target is specified, that will be the filename. In the
206-
example above, two files will be created: `/run/secrets/ssh` and
203+
Secrets are located in `/run/secrets` in the container if no target is specified.
204+
If no target is specified, the name of the secret is used as the in memory file
205+
in the container. If a target is specified, that is used as the filename. In the
206+
example above, two files are created: `/run/secrets/ssh` and
207207
`/run/secrets/app` for each of the secret targets specified.
208208

209+
### Create a service with configs
210+
211+
Use the `--config` flag to give a container access to a
212+
[config](config_create.md).
213+
214+
Create a service with a config. The config will be mounted into `redis-config`,
215+
be owned by the user who runs the command inside the container (often `root`),
216+
and have file mode `0444` or world-readable. You can specify the `uid` and `gid`
217+
as numerical IDs or names. When using names, the provided group/user names must
218+
pre-exist in the container. The `mode` is specified as a 4-number sequence such
219+
as `0755`.
220+
221+
```bash
222+
$ docker service create --name=redis --config redis-conf redis:3.0.6
223+
```
224+
225+
Create a service with a config and specify the target location and file mode:
226+
227+
```bash
228+
$ docker service create --name redis \
229+
--config source=redis-conf,target=/etc/redis/redis.conf,mode=0400 redis:3.0.6
230+
```
231+
232+
To grant a service access to multiple configs, use multiple `--config` flags.
233+
234+
Configs are located in `/` in the container if no target is specified. If no
235+
target is specified, the name of the config is used as the name of the file in
236+
the container. If a target is specified, that is used as the filename.
237+
209238
### Create a service with a rolling update policy
210239

211240
```bash

0 commit comments

Comments
 (0)