Swarm is Docker’s built-in cluster manager. It groups several Docker hosts so you can treat them as one resource.
Two major components
-
Enterprise-grade secure cluster
- Manage one or more Docker nodes as a cluster.
- Encrypted distributed cluster store.
- Encrypted networks.
- Secure join tokens.
-
Orchestration engine for microservices
- API for deploying and managing microservices.
- Declarative manifest files.
- Rolling updates, rollbacks, and scaling.
Nodes
A swarm consists of one or more Docker nodes. Each node is either a manager or a worker.
Managers:
- Manage cluster state.
- Dispatch tasks to workers.
Workers:
- Accept and execute tasks.
State is stored in etcd.
Security
Swarm uses Transport Layer Security (TLS) for:
- encrypted communication;
- node authentication;
- role authorization.
Services and tasks
The atomic scheduling unit is a swarm service. A service adds to a plain container:
- scaling;
- rolling updates;
- rollback.
A container wrapped in a service is a task or replica.
A service is an application running in the swarm. It has a replica count — how many copies of the task to run.
A task is essentially one container scheduled on a swarm node.
Networking
In Swarm mode, Docker creates:
- an ingress overlay network (default);
- docker_gwbridge to connect node daemons.
See Networking for CNM and driver details.
Related topics
- Orchestration — Swarm vs Kubernetes vs Mesos
- Service discovery — external discovery tools
- WordPress as a stack
— example
docker stack deploy
Andrew Dorokhov