Add nodes to the swarm (original) (raw)
Once you've created a swarm with a manager node, you're ready to add worker nodes.
- Open a terminal and ssh into the machine where you want to run a worker node. This tutorial uses the name
worker1
. - Run the command produced by the
docker swarm init
output from theCreate a swarm tutorial step to create a worker node joined to the existing swarm:
If you don't have the command available, you can run the following command on a manager node to retrieve the join command for a worker: - Open a terminal and ssh into the machine where you want to run a second worker node. This tutorial uses the name
worker2
. - Run the command produced by the
docker swarm init
output from theCreate a swarm tutorial step to create a second worker node joined to the existing swarm: - Open a terminal and ssh into the machine where the manager node runs and run the
docker node ls
command to see the worker nodes:
TheMANAGER
column identifies the manager nodes in the swarm. The empty status in this column forworker1
andworker2
identifies them as worker nodes.
Swarm management commands likedocker node ls
only work on manager nodes.
Now your swarm consists of a manager and two worker nodes. Next, you'll deploy a service.