Scale the service in the swarm (original) (raw)

Once you have deployed a service to a swarm, you are ready to use the Docker CLI to scale the number of containers in the service. Containers running in a service are called tasks.

  1. If you haven't already, open a terminal and ssh into the machine where you run your manager node. For example, the tutorial uses a machine namedmanager1.
  2. Run the following command to change the desired state of the service running in the swarm:
    For example:
  3. Run docker service ps <SERVICE-ID> to see the updated task list:
    You can see that swarm has created 4 new tasks to scale to a total of 5 running instances of Alpine Linux. The tasks are distributed between the three nodes of the swarm. One is running on manager1.
  4. Run docker ps to see the containers running on the node where you're connected. The following example shows the tasks running on manager1:
    If you want to see the containers running on other nodes, ssh into those nodes and run the docker ps command.

At this point in the tutorial, you're finished with the helloworld service. Next, you'll delete the service

Delete the service