The following ports must be available. On some systems, these ports are open by default.

TCP port 2377 for cluster management communications TCP and UDP port 7946 for communication among nodes UDP port 4789 for overlay network traffic

If you plan on creating an overlay network with encryption (–opt encrypted), you also need to ensure ip protocol 50 (ESP) traffic is allowed.

Init/join cluster:

docker swarm init --advertise-addr <ip>

# join to cluster
docker swarm join --token <token> <ip>:2377


docker info
docker node ls  # shwo nodes in cluster

# get join token (run on master)
docker swarm join-token worker -q

# inspect node
docker node inspect <node>

# change node activity
docker node update --availability drain <worker_hostname>
docker node update --availability active <NODE-ID>

# add/rm node labels
docker node update --label-add <key>=<value> <node>
docker node update --label-rm <key>=<value> <node>

# run service only on workers
docker service create --constraint node.role==worker <service>