Docker's built-in orchestrator · services · jobs · stacks · overlay · secrets · CSI volumes · verified against Docker Engine 29 (2026)

Docker Swarm cheat sheet

Swarm mode is built into the Docker Engine — no extra install. Turn a set of Docker hosts into one cluster with docker swarm init, then run services (replicated or global) across it, connect them over overlay networks, deploy multi-service apps from a Compose file as a stack, and ship config & secrets securely. The built-in routing mesh load-balances a published port across every node. This edition adds service jobs (run-to-completion), service templating, cluster security (autolock, CA & token rotation), and CSI cluster volumes for portable storage. It's the simplest path to multi-host orchestration when Kubernetes is more than you need.

cluster · nodes · security services · jobs · updates networks & routing stacks · secrets · storage ops & ecosystem gotcha most common

Verified 2026-09-07 against the official docs at docs.docker.com/engine/swarm & the docker service/volume CLI reference, on Docker Engine 29.x. Swarm ships inside the Docker Engine (CE) — docker swarm/node/service/stack/secret/config are core commands. Service jobs since Engine 20.10; CSI cluster volumes since Engine 23. See also the companion Docker, Docker Compose & Dockerfile sheets.

Outline

Init a swarm, join & secure nodes, then declare services or jobs (or deploy a stack). Overlay networks connect them; the routing mesh publishes ports; secrets/configs/CSI volumes supply data safely.

Cluster & services

  1. 1Init & join
  2. 2Managing nodes
  3. 3Cluster security
  4. 4Services
  5. 5Service jobs

Services & networking

  1. 6Scale & update
  2. 7Service templating
  3. 8Overlay networks
  4. 9Routing mesh & ports

Storage & ops

  1. 10Stacks
  2. 11Secrets & configs
  3. 12Cluster volumes (CSI)
  4. 13Placement & resources
  5. 14Rolling updates & health
  6. 15Inspect & debug
  7. 16Swarm vs Kubernetes

Cluster, Nodes & Security

Form the cluster, manage nodes, and lock it down.

1Init & joinform the swarm
2Managing nodesmanagers & workers
3Cluster securityautolock · CA · tokens
4Servicesthe unit of work
5Service jobsrun to completion

Services & Networking

Update & template services; connect them across hosts.

6Scale & updatechange desired state
7Service templatingper-task values
8Overlay networksmulti-host
9Routing mesh & portspublish

Stacks, Secrets & Storage

Deploy whole apps, inject data, and attach portable volumes.

10StacksCompose in prod
11Secrets & configsinject data safely
12Cluster volumes (CSI)portable storage

Ops & Ecosystem

Place tasks, roll out safely, debug, and know when to reach for Kubernetes.

13Placement & resourceswhere tasks run
14Rolling updates & healthsafe deploys
15Inspect & debugwhat's wrong
16Swarm vs Kuberneteschoosing

Worth memorizing

swarm init --advertise-addrfirst node = manager
swarm join --token ...:2377add workers
3 or 5 managersodd count for Raft quorum
swarm --autolock / unlock-keyencrypt Raft at rest; save the key
--mode replicated-job / global-jobrun to completion
service create --replicas / --mode globalthe unit of work
"{{.Node.Hostname}}" / .Task.Slotper-task templating
--update-order start-firstzero-downtime rollout
network create -d overlay [--opt encrypted]cross-node; DNS by name
stack deploy -c compose.ymluses deploy:; no build:
secret create -> /run/secrets/encrypted, in-memory; immutable
volume create --driver <csi> · --mount type=clusterportable storage
--rollback-parallelism/-monitor/-ordertune how a bad deploy unwinds
service ps --no-truncsee the real failure reason