Docker Swarm and FirewallTE.01

FIGURE.01Docker Swarm and Firewall

Demo post with original placeholder copy. Open only what Swarm needs between managers and workers.

ufw allow 2377/tcp   # swarm mode
ufw allow 7946/tcp   # gossip
ufw allow 7946/udp
ufw allow 4789/udp   # overlay
ufw enable

Deny the rest by default and test failover before calling it done.

Check your work

List the rules with ufw status numbered and confirm the defaults first: incoming deny, outgoing allow. Then verify gossip and overlay traffic flows between nodes.

  • Drain a manager and confirm the cluster stays green.
  • Move a service between nodes and watch its tasks reschedule.
  • Reboot one worker and check it rejoins on its own.

Document each open port next to its reason. Future you will thank present you during the next audit.

ARTICLE_END // DATE: 2022.07.01 // ID: POST-2022-7