Skip to content

Commit fbee068

Browse files
eznix86aevesdocker
andauthored
docs: add missing deploy modes for compose file reference (#21606)
## Description Noticed that on the source code we had two more modes: https://github.com/moby/swarmkit/blob/e8ecf83ee08e14a05e28992dc304576079d403c7/api/specs.proto#L106 https://github.com/moby/moby/blob/9633556bef3eb20dfe888903660c3df89a73605b/daemon/cluster/convert/service.go#L142 ## Related issues or tickets ## Reviews - [ ] Technical review - [x] Editorial review - [ ] Product review --------- Co-authored-by: Allie Sadler <[email protected]>
1 parent e613939 commit fbee068

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

content/reference/compose-file/deploy.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,42 @@ services:
5050

5151
### `mode`
5252

53-
`mode` defines the replication model used to run the service on the platform. Either `global`, exactly one container per physical node, or `replicated`, a specified number of containers. The default is `replicated`.
53+
`mode` defines the replication model used to run a service or job. Options include:
54+
55+
- `global`: Ensures exactly one task continuously runs per physical node until stopped.
56+
- `replicated`: Continuously runs a specified number of tasks across nodes until stopped (default).
57+
- `replicated-job`: Executes a defined number of tasks until a completion state (exits with code 0)'.
58+
- Total tasks are determined by `replicas`.
59+
- Concurrency can be limited using the `max-concurrent` option (CLI only).
60+
- `global-job`: Executes one task per physical node with a completion state (exits with code 0).
61+
- Automatically runs on new nodes as they are added.
5462

5563
```yml
5664
services:
5765
frontend:
5866
image: example/webapp
5967
deploy:
6068
mode: global
69+
70+
batch-job:
71+
image: example/processor
72+
deploy:
73+
mode: replicated-job
74+
replicas: 5
75+
76+
maintenance:
77+
image: example/updater
78+
deploy:
79+
mode: global-job
6180
```
6281

82+
> [!NOTE]
83+
> - Job modes (`replicated-job` and `global-job`) are designed for tasks that complete and exit with code 0.
84+
> - Completed tasks remain until explicitly removed.
85+
> - Options like `max-concurrent` for controlling concurrency are supported only via the CLI and are not available in Compose.
86+
87+
For more detailed information about job options and behavior, see the [Docker CLI documentation](/reference/cli/docker/service/create.md#running-as-a-job)
88+
6389
### `placement`
6490

6591
`placement` specifies constraints and preferences for the platform to select a physical node to run service containers.

0 commit comments

Comments
 (0)