Configuring Swarm Nodes

Docker swarm worker nodes handle the processing of workloads in the swarm cluster. We have already set up a swarm manager, so in this lesson we will discuss the process of adding worker nodes to the swarm. We will demonstrate this by adding our two worker nodes to the cluster that was initialized in the previous lesson.
Relevant Documentation

– Install Docker Engine on both worker nodes:

sudo apt-get update

sudo apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \

curl -fsSL | sudo apt-key add –

sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository \
“deb [arch=amd64] \
$(lsb_release -cs) \

sudo apt-get update

sudo apt-get install -y docker-ce=5:18.09.5~3-0~ubuntu-bionic docker-ce-cli=5:18.09.5~3-0~ubuntu-bionic

sudo usermod -a -G docker cloud_user

– Get a join token from the manager. Run this command on the swarm manager:

docker swarm join-token worker

– Now copy the docker swarm join command provided in the output and run it on both workers:

docker swarm join –token <token> <swarm manager private IP>:2377

– On the swarm manager, verify that the two worker nodes have successfully joined:

docker node ls

No token or token has expired.