← All notes

Docker Swarm services: declare a desired state and let the swarm keep it

Answer: Swarm services use a declarative model: you define the desired state, and Docker maintains it.

What the desired state includes

The state includes the image name and tag the service containers should run.

It also includes how many containers participate in the service.

It can record whether any ports are exposed to clients outside the swarm.

It can say whether the service should start automatically when Docker starts.

Creating a simple service

A service with one replica and no extra settings needs only the image name.

Restart behavior, such as a rolling restart, can be part of the declared state.

You can also describe characteristics of the nodes where the service can run.

Those characteristics include resource constraints and placement preferences.

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., Deploy services to a swarm; Docker, Inc., Deploy services to a swarm (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., Deploy services to a swarm; Docker, Inc., Deploy services to a swarm (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc.

Cite this

Permanent ID: iil:note:aphcfn83

iinventedlight. 2026. "Docker Swarm services: declare a desired state and let the swarm keep it." iinventedlight Library, iil:note:aphcfn83, version of 2026-11-26. https://iinventedlight.com/library/notes/docker-swarm-services/. License: CC-BY-4.0.

@misc{iil_note_aphcfn83,
  author = {{iinventedlight}},
  title = {{Docker Swarm services: declare a desired state and let the swarm keep it}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-26},
  url = {https://iinventedlight.com/library/notes/docker-swarm-services/},
  note = {Permanent ID iil:note:aphcfn83. 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-services.md.