github.com/portworx/docker@v1.12.1/docs/swarm/swarm-tutorial/scale-service.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Scale the service"
     4  description = "Scale the service running in the swarm"
     5  keywords = ["tutorial, cluster management, swarm mode, scale"]
     6  [menu.main]
     7  identifier="swarm-tutorial-scale-service"
     8  parent="swarm-tutorial"
     9  weight=18
    10  +++
    11  <![end-metadata]-->
    12  
    13  # Scale the service in the swarm
    14  
    15  Once you have [deployed a service](deploy-service.md) to a swarm, you are ready
    16  to use the Docker CLI to scale the number of service ps in
    17  the swarm.
    18  
    19  1. If you haven't already, open a terminal and ssh into the machine where you
    20  run your manager node. For example, the tutorial uses a machine named
    21  `manager1`.
    22  
    23  2. Run the following command to change the desired state of the
    24  service running in the swarm:
    25  
    26      ```bash
    27      $ docker service scale <SERVICE-ID>=<NUMBER-OF-TASKS>
    28      ```
    29  
    30      For example:
    31  
    32      ```bash
    33      $ docker service scale helloworld=5
    34  
    35      helloworld scaled to 5
    36      ```
    37  
    38  3. Run `docker service ps <SERVICE-ID>` to see the updated task list:
    39  
    40      ```
    41      $ docker service ps helloworld
    42  
    43      ID                         NAME          SERVICE     IMAGE   LAST STATE          DESIRED STATE  NODE
    44      8p1vev3fq5zm0mi8g0as41w35  helloworld.1  helloworld  alpine  Running 7 minutes   Running        worker2
    45      c7a7tcdq5s0uk3qr88mf8xco6  helloworld.2  helloworld  alpine  Running 24 seconds  Running        worker1
    46      6crl09vdcalvtfehfh69ogfb1  helloworld.3  helloworld  alpine  Running 24 seconds  Running        worker1
    47      auky6trawmdlcne8ad8phb0f1  helloworld.4  helloworld  alpine  Running 24 seconds  Accepted       manager1
    48      ba19kca06l18zujfwxyc5lkyn  helloworld.5  helloworld  alpine  Running 24 seconds  Running        worker2
    49      ```
    50  
    51      You can see that swarm has created 4 new tasks to scale to a total of 5
    52      running instances of Alpine Linux. The tasks are distributed between the
    53      three nodes of the swarm. One is running on `manager1`.
    54  
    55  4. Run `docker ps` to see the containers running on the node where you're
    56  connected. The following example shows the tasks running on `manager1`:
    57  
    58      ```
    59      $ docker ps
    60  
    61      CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    62      528d68040f95        alpine:latest       "ping docker.com"   About a minute ago   Up About a minute                       helloworld.4.auky6trawmdlcne8ad8phb0f1
    63      ```
    64  
    65      If you want to see the containers running on other nodes, you can ssh into
    66      those nodes and run the `docker ps` command.
    67  
    68  ## What's next?
    69  
    70  At this point in the tutorial, you're finished with the `helloworld` service.
    71  The next step shows how to [delete the service](delete-service.md).