Add nodes to the swarm (original) (raw)

Once you've created a swarm with a manager node, you're ready to add worker nodes.

  1. Open a terminal and ssh into the machine where you want to run a worker node. This tutorial uses the name worker1.
  2. 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:
  3. Open a terminal and ssh into the machine where you want to run a second worker node. This tutorial uses the name worker2.
  4. 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:
  5. 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:
    The MANAGER column identifies the manager nodes in the swarm. The empty status in this column for worker1 and worker2 identifies them as worker nodes.
    Swarm management commands like docker node ls only work on manager nodes.

Now your swarm consists of a manager and two worker nodes. Next, you'll deploy a service.

Deploy a service