Managers and quorum

Managers agree through Raft: every change needs a majority of all the managers. 3 managers tolerate 1 failure, 5 tolerate 2; 2 managers tolerate none.

How it works

One manager is the Leader, the others are Reachable followers. When the leader disappears and a majority remains, a new one is elected within seconds. docker node promote and docker node demote change roles. Use an odd number, spread over failure domains (power, racks, zones); managers can be drained so that they only manage.

What breaks

Without a majority the swarm freezes: running tasks go on, but no command works (The swarm does not have a leader), and a task that stops is never replaced. Adding a second manager for redundancy makes things worse: now either of two machines can freeze the cluster.

In a terminal

docker node ls
docker node promote worker-1
docker node ls   # 1 Leader, 2 Reachable: one manager may fail

See it break, then fix it

Write the Dockerfile or the compose file, type the docker commands, and watch a simulated server run them through reboots, upgrades and traffic. Free to start.