Docker Swarm mode services: tasks, replicas, and global workloads
Answer: Creating a service means choosing the container image and the commands to execute inside running containers.
Tasks and desired state
You also define options for the service, such as load balancing between three instances of an HTTP listener.
Each of the three instances of the listener is a task in the swarm.
A task moves only forward, monotonically, through states such as ASSIGNED, PREPARING, and RUNNING.
When a task fails, the orchestrator removes that task and container, then creates a replacement according to the service's desired state.
If no node currently in the swarm can run its tasks, the service remains in state pending. Placement constraints may not be able to be honored at a given time.
To prevent a service from being deployed, scale it to 0 rather than leaving it pending.
Replicated and global services
Good candidates for global services are monitoring agents, anti-virus scanners, or other containers that you want to run on every node in the swarm.
For a replicated service, you specify the number of identical tasks you want to run, such as an HTTP service with three replicas, each serving the same content.
There are two types of service deployments, replicated and global.
A global service runs one task on every node, without a pre-specified number of tasks.
Adding a node to the swarm makes the orchestrator create a task, and the scheduler assigns it to the new node.
See also
Claims
- id: C1 claim: Swarm mode has replicated services and global services. source: S1 evidence: "There are two types of service deployments, replicated and global."
- id: C2 claim: A global service places one task on every node. source: S1 evidence: "A global service is a service that runs one task on every node."
- id: C3 claim: The markdown source describes the same replicated and global deployment types. source: S2 evidence: "There are two types of service deployments, replicated and global."
Sources
- [S1] How Swarm mode works: services. Docker, Inc.. https://docs.docker.com/engine/swarm/how-swarm-mode-works/services/ . License: Apache License 2.0. Accessed 2026-11-26.
- [S2] How Swarm mode works: services (source). Docker, Inc.. https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/swarm/how-swarm-mode-works/services.md . License: Apache License 2.0. Accessed 2026-11-26.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker, Inc., How Swarm mode works: services; Docker, Inc., How Swarm mode works: services (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Docker, Inc., How Swarm mode works: services; Docker, Inc., How Swarm mode works: services (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc.
Cite this
iinventedlight. 2026. "Docker Swarm mode services: tasks, replicas, and global workloads." iinventedlight Library, iil:note:gej5kvye, version of 2026-11-26. https://iinventedlight.com/library/notes/docker-swarm-mode-services/. License: CC-BY-4.0.
@misc{iil_note_gej5kvye,
author = {{iinventedlight}},
title = {{Docker Swarm mode services: tasks, replicas, and global workloads}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-26},
url = {https://iinventedlight.com/library/notes/docker-swarm-mode-services/},
note = {Permanent ID iil:note:gej5kvye. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- docker-swarm-mode-services.schema.json (schema; CC-BY-4.0)
- docker-swarm-mode-services.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/docker-swarm-mode-services.md.