Docker Swarm How To Join
Joining a swarm is easy. Follow these examples to join nodes to your own swarm.
Create Swarm and Grab Tokens for Joining
Swap out any IPs for addresses that you have selected on your own network.
Create new swarm:
docker swarm init --advertise-addr 192.168.99.100
Get the join command and token for workers:
docker swarm join-token worker
Get the token to add a manager:
docker swarm join-token manager
Join Example
Use the actual command and token that you save previously. Below is an example of what this would look like. Remember, use YOUR TOKEN, not the exact token that I show in the example below.
Connect to a worker:
ssh worker1
From the worker:
docker swarm join --token SWMTKN-1-05wlarqh76frzmueb8xcz4tgz7i5fj7x8b6ltl1nimsoxfatwx-2ftetfti9nad5c0lnq6ree7s0 192.168.99.100:2377
Token Rotation
Rotate join tokens ( probably do this every 6 months ):
docker swarm join-token --rotate
docker swarm join-token --rotate worker