Containers
Docker Swarm
Docker Swarm mode is Docker's built-in orchestrator. It turns a group of Docker hosts into one cluster that keeps services at a desired number of replicas, spreads them across nodes, load-balances traffic to them, rolls out updates, and distributes secrets — all using the compose file format you already know. Few Bangalore teams run Swarm today, but interviewers still ask it to test orchestration fundamentals (desired state, consensus, scheduling, service discovery) and to see whether you can compare it honestly with Kubernetes.
After this topic you can
- Run services on a small Docker Swarm cluster
- Perform rolling updates and manage secrets
- Compare Swarm with Kubernetes honestly
Lessons
-
1What Swarm is and where it fits
- Swarm mode vs "classic Swarm"
- Why learn it
-
2Architecture: managers, workers and Raft
- Node roles
- Raft and quorum
- Built-in security (PKI)
- Ports to open between nodes
-
3Services, tasks and scheduling
- The desired-state model
- Replicated vs global
- Placement
- Node availability
-
4Networking and the routing mesh
- Overlay networks
- Service discovery: VIP vs DNS round robin
- The ingress routing mesh
-
5Stacks: compose files for the cluster
- Deploying a stack
- The deploy section
-
6Secrets and configs
- Swarm secrets
- Configs
-
7Rolling updates, health and rollback
- How an update rolls
-
8Operating a swarm
- Backup and restore
- Storage for stateful services
- Upgrading Docker across the cluster
- Monitoring and logging
-
9Troubleshooting and choosing an orchestrator
- Common problems
- Swarm vs Kubernetes vs ECS
-
10Interview questions and model answers
- "Why should a swarm have an odd number of managers?"
- "What happens if the swarm loses quorum?"
- "Explain the routing mesh."
- "How does Swarm handle secrets, and how do you rotate one?"
- "How do you do a zero-downtime update in Swarm?"
- "Containers on two nodes can't reach each other over an overlay. What do you check?"
- "Swarm or Kubernetes for a new platform?"