How to join a node to a Docker Swarm

[ad_1]

Jack Wallen shows you the steps of joining new nodes to a Docker Swarm as a worker and manager to help with managing larger Docker clusters.

Do you have a Docker Swarm up and running and you need to add more nodes to it? You probably remember how the initialization of the Docker Swarm presented you with the join command. The join token from that command can only be used one time, so even if you copied that command to a file, it won’t work for a new node.

Fortunately, however, the Docker developers made it possible to join new nodes to a Swarm at any time. To do this, you’ll need to have a Docker Swarm up and running with at least a controller node and a new node to join. You can add as many nodes as you need and do so at any time.

You can join a node as a worker or a manager. The difference is simple: Manager nodes elect a leader to conduct orchestration tasks, whereas worker nodes receive and execute tasks that are dispatched from manager nodes. Most likely, you’ll join the node as a worker, but I’ll show you the commands for both.

First, let’s join a node as a worker. Log into your Docker Swarm controller node, and issue the command docker swarm join-token worker. The output will include the docker swarm join command you will run on the new worker node. If you need to generate a new token, use the rotate option like so: docker swarm join-token --rotate worker.

Now, if you want to join a node as a manager, the command is docker swarm join-token manager. To create a new join token, you can use the rotate option in the same way with docker swarm join-token --rotate manager.

Once you run one of those commands on your new node, it will join the Swarm as either a worker or a manager, and you’re all set to develop for and manage a larger Docker cluster.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

[ad_2]

Tech Republic