Skip to main content
In this guide, you’ll learn how to configure a Docker Swarm cluster in HA mode with three manager nodes and three worker nodes. We’ll cover initialization, adding managers and workers, testing quorum, and restoring cluster health.

Prerequisites

  • Six CentOS 7.6 VMs (2 vCPU, 4 GB RAM) on AWS
  • Docker 19.03 installed on all nodes
  • Swarm ports open (2377, 7946 TCP/UDP, 4789 UDP)
  • Fully qualified hostnames and name resolution for all nodes
Verify OS and Docker:
Verify network connectivity:

1. Initialize the Swarm

On managerone, initialize the Swarm and advertise its IP:
Confirm Swarm status:
The --advertise-addr flag sets the manager’s reachable IP for new nodes.

2. Add Additional Managers

2.1 Retrieve Manager Join Token

On managerone:

2.2 Join managertwo and managerthree

On each additional manager node:
Repeat on managerthree.

2.3 Verify Managers

From managerone:

3. Add Worker Nodes

3.1 Retrieve Worker Join Token

On managerone:

3.2 Join workerone, workertwo, workerthree

On each worker:
Verify all nodes:

4. Testing Manager Quorum

Docker Swarm requires a majority of manager nodes to maintain a leader.

4.1 Simulate One Manager Failure

On managertwo:
Check from managerone:
The cluster remains healthy (2 of 3 managers online).

4.2 Simulate Two Manager Failures

On managerthree:
Then on managerone:
With only one manager online, the cluster loses quorum and cannot elect a leader.
Never simulate quorum loss in production. You will lose control over scheduling and service updates.

5. Restoring Quorum

  1. Start Docker on managertwo:
  2. Wait for the node to rejoin (quorum 2/3 restored).
  3. Start Docker on managerthree:
  4. Verify:
All managers should show Leader or Reachable.

Conclusion

You’ve now deployed a Docker Swarm in HA mode, added managers and workers, tested quorum behavior, and restored cluster health. This setup ensures fault tolerance and continuous service availability.

Watch Video