Skip to content

Commit

Permalink
docs: add missing deploy modes for compose file reference (#21606)
Browse files Browse the repository at this point in the history
## 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]>
  • Loading branch information
eznix86 and aevesdocker authored Jan 8, 2025
1 parent e613939 commit fbee068
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion content/reference/compose-file/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,42 @@ 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:
frontend:
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.
Expand Down

0 comments on commit fbee068

Please sign in to comment.