mirror of https://github.com/docker/docs.git
docs: add missing deploy modes for compose file reference (#21606)
## Description Noticed that on the source code we had two more modes:e8ecf83ee0/api/specs.proto (L106)9633556bef/daemon/cluster/convert/service.go (L142)## Related issues or tickets ## Reviews - [ ] Technical review - [x] Editorial review - [ ] Product review --------- Co-authored-by: Allie Sadler <102604716+aevesdocker@users.noreply.github.com>
This commit is contained in:
parent
e6139394c7
commit
fbee068025
|
|
@ -50,7 +50,15 @@ 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 a service or job. Options include:
|
||||
|
||||
- `global`: Ensures exactly one task continuously runs per physical node until stopped.
|
||||
- `replicated`: Continuously runs a specified number of tasks across nodes until stopped (default).
|
||||
- `replicated-job`: Executes a defined number of tasks until a completion state (exits with code 0)'.
|
||||
- Total tasks are determined by `replicas`.
|
||||
- Concurrency can be limited using the `max-concurrent` option (CLI only).
|
||||
- `global-job`: Executes one task per physical node with a completion state (exits with code 0).
|
||||
- Automatically runs on new nodes as they are added.
|
||||
|
||||
```yml
|
||||
services:
|
||||
|
|
@ -58,8 +66,26 @@ services:
|
|||
image: example/webapp
|
||||
deploy:
|
||||
mode: global
|
||||
|
||||
batch-job:
|
||||
image: example/processor
|
||||
deploy:
|
||||
mode: replicated-job
|
||||
replicas: 5
|
||||
|
||||
maintenance:
|
||||
image: example/updater
|
||||
deploy:
|
||||
mode: global-job
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> - Job modes (`replicated-job` and `global-job`) are designed for tasks that complete and exit with code 0.
|
||||
> - Completed tasks remain until explicitly removed.
|
||||
> - Options like `max-concurrent` for controlling concurrency are supported only via the CLI and are not available in Compose.
|
||||
|
||||
For more detailed information about job options and behavior, see the [Docker CLI documentation](/reference/cli/docker/service/create.md#running-as-a-job)
|
||||
|
||||
### `placement`
|
||||
|
||||
`placement` specifies constraints and preferences for the platform to select a physical node to run service containers.
|
||||
|
|
|
|||
Loading…
Reference in New Issue