From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- ...m%2Fswarm-tutorial%2Fscale-service%2Findex.html | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fscale-service%2Findex.html (limited to 'devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fscale-service%2Findex.html') diff --git a/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fscale-service%2Findex.html b/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fscale-service%2Findex.html new file mode 100644 index 00000000..5270a03c --- /dev/null +++ b/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fscale-service%2Findex.html @@ -0,0 +1,25 @@ +

Scale the service in the swarm

+

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 named manager1.

  2. Run the following command to change the desired state of the service running in the swarm:

    $ docker service scale <SERVICE-ID>=<NUMBER-OF-TASKS>
    +

    For example:

    $ docker service scale helloworld=5
    +
    +helloworld scaled to 5
    +
  3. Run docker service ps <SERVICE-ID> to see the updated task list:

    $ docker service ps helloworld
    +
    +NAME                                    IMAGE   NODE      DESIRED STATE  CURRENT STATE
    +helloworld.1.8p1vev3fq5zm0mi8g0as41w35  alpine  worker2   Running        Running 7 minutes
    +helloworld.2.c7a7tcdq5s0uk3qr88mf8xco6  alpine  worker1   Running        Running 24 seconds
    +helloworld.3.6crl09vdcalvtfehfh69ogfb1  alpine  worker1   Running        Running 24 seconds
    +helloworld.4.auky6trawmdlcne8ad8phb0f1  alpine  manager1  Running        Running 24 seconds
    +helloworld.5.ba19kca06l18zujfwxyc5lkyn  alpine  worker2   Running        Running 24 seconds
    +

    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:

    $ docker ps
    +
    +CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    +528d68040f95        alpine:latest       "ping docker.com"   About a minute ago   Up About a minute                       helloworld.4.auky6trawmdlcne8ad8phb0f1
    +

    If you want to see the containers running on other nodes, ssh into those nodes and run the docker ps command.

What’s next?

At this point in the tutorial, you’re finished with the helloworld service. The next step shows how to delete the service.

+

tutorial, cluster management, swarm mode, scale

+
+

+ © 2019 Docker, Inc.
Licensed under the Apache License, Version 2.0.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
Docker, Inc. and other parties may also have trademark rights in other terms used herein.
+ https://docs.docker.com/engine/swarm/swarm-tutorial/scale-service/ +

+
-- cgit v1.2.3