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

Commit d9eb3c2

Browse files
Misty Stanley-JonesthaJeztah
authored andcommitted
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 473a9d20cd4f4fce3b14d494710932d7fa9b1af1) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: be602975148ddf7c25a26a7ee823a8c759dc6bb4 Component: cli
1 parent 9e55c7c commit d9eb3c2

1 file changed

Lines changed: 33 additions & 4 deletions

File tree

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)