Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add missing deploy modes for compose file reference #21606

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion content/reference/compose-file/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ services:

### mode

`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`.
`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`.

Two additional modes are available for jobs:
- `replicated-job`: A job that runs a specified number of tasks with controlled parallelism
- `global-job`: A job that runs once on each swarm node

```yml
services:
Expand All @@ -60,6 +64,27 @@ services:
mode: global
```

For job modes, additional parameters can be specified:

```yml
services:
batch-job:
image: example/processor
deploy:
mode: replicated-job
replicas: 1
max_concurrent: 2 # Maximum parallel job tasks
total_completions: 10 # Total number of times to run

maintenance:
image: example/updater
deploy:
mode: global-job # Runs once on each node
```

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.


### placement

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