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