Skip to content

Commit af7deb8

Browse files
authored
docs: add missing modes for compose file reference
1 parent 8c85f1c commit af7deb8

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

content/reference/compose-file/deploy.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ 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 the service on the platform. Either `global`, exactly one container per physical node, or `replicated`, a specified number of containers. The default is `replicated`.
54+
55+
Two additional modes are available for jobs:
56+
- `replicated-job`: A job that runs a specified number of tasks with controlled parallelism
57+
- `global-job`: A job that runs once on each swarm node
5458

5559
```yml
5660
services:
@@ -60,6 +64,27 @@ services:
6064
mode: global
6165
```
6266

67+
For job modes, additional parameters can be specified:
68+
69+
```yml
70+
services:
71+
batch-job:
72+
image: example/processor
73+
deploy:
74+
mode: replicated-job
75+
replicas: 1
76+
max_concurrent: 2 # Maximum parallel job tasks
77+
total_completions: 10 # Total number of times to run
78+
79+
maintenance:
80+
image: example/updater
81+
deploy:
82+
mode: global-job # Runs once on each node
83+
```
84+
85+
Note: Job modes are designed for tasks that have a finite completion state, unlike services which run continuously. Once a job completes, its containers exit but the service remains in the swarm until removed.
86+
87+
6388
### placement
6489

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

0 commit comments

Comments
 (0)