Docker Swarm turns a pool of Docker hosts into a single virtual host. You deploy services (with replicas) and the swarm schedules them across nodes. See official Swarm docs.
Last updated: April 2026
Swarm is part of Docker Engine. Check whether the current node is in swarm mode.
docker info | grep -i swarmRun on the machine that will be the manager. Only run once per cluster.
docker swarm initSave your compose file (e.g. stack.yml) and deploy. Use pre-built images (no build: in Swarm unless you build on each node).
docker stack deploy -c stack.yml mystackdocker service lsdocker node lsdocker service scale mystack_web=3docker stack rm mystackCompose file suitable for docker stack deploy. Uses image only (no build).
services:
web:
image: nginx:alpine
deploy:
replicas: 2
restart_policy:
condition: on-failure
ports:
- "80:80"
SwarmBot
AI-powered assistant