← All notes

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

Sources

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

Permanent ID: iil:note:gej5kvye

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.},
}

Markdown

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.

All artifact files (JSON index)

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.