Skip to content

Commit 8c10661

Browse files
authored
docs: improve docs deploy mode
1 parent af7deb8 commit 8c10661

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

content/reference/compose-file/deploy.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,40 +50,40 @@ 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:
5454

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
55+
1. **`global`**: Ensures exactly one task continuously runs per physical node until stopped.
56+
2. **`replicated`**: Continuously runs a specified number of tasks across nodes until stopped (default).
57+
3. **`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+
4. **`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.
5862

5963
```yml
6064
services:
6165
frontend:
6266
image: example/webapp
6367
deploy:
6468
mode: global
65-
```
66-
67-
For job modes, additional parameters can be specified:
6869
69-
```yml
70-
services:
7170
batch-job:
7271
image: example/processor
7372
deploy:
7473
mode: replicated-job
75-
replicas: 1
76-
max_concurrent: 2 # Maximum parallel job tasks
77-
total_completions: 10 # Total number of times to run
74+
replicas: 5
7875
7976
maintenance:
8077
image: example/updater
8178
deploy:
82-
mode: global-job # Runs once on each node
79+
mode: global-job
8380
```
8481

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-
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 YAML.
86+
- For more detailed information about job options and behavior, see the [Docker CLI documentation](/reference/cli/docker/service/create/#running-as-a-job)
8787

8888
### placement
8989

0 commit comments

Comments
 (0)