diff options
Diffstat (limited to 'devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fscale-service%2Findex.html')
| -rw-r--r-- | devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fscale-service%2Findex.html | 25 |
1 files changed, 25 insertions, 0 deletions
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 @@ +<h1>Scale the service in the swarm</h1> +<p>Once you have <a href="../deploy-service/index">deployed a service</a> 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.”</p> <ol> <li> <p>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 <code class="language-plaintext highlighter-rouge">manager1</code>.</p> </li> <li> <p>Run the following command to change the desired state of the service running in the swarm:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service scale <SERVICE-ID>=<NUMBER-OF-TASKS> +</pre></div> <p>For example:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service scale helloworld=5 + +helloworld scaled to 5 +</pre></div> </li> <li> <p>Run <code class="language-plaintext highlighter-rouge">docker service ps <SERVICE-ID></code> to see the updated task list:</p> <div class="highlight"><pre class="highlight" data-language="">$ 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 +</pre></div> <p>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 <code class="language-plaintext highlighter-rouge">manager1</code>.</p> </li> <li> <p>Run <code class="language-plaintext highlighter-rouge">docker ps</code> to see the containers running on the node where you’re connected. The following example shows the tasks running on <code class="language-plaintext highlighter-rouge">manager1</code>:</p> <div class="highlight"><pre class="highlight" data-language="">$ 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 +</pre></div> <p>If you want to see the containers running on other nodes, ssh into those nodes and run the <code class="language-plaintext highlighter-rouge">docker ps</code> command.</p> </li> </ol> <h2 id="whats-next">What’s next?</h2> <p>At this point in the tutorial, you’re finished with the <code class="language-plaintext highlighter-rouge">helloworld</code> service. The next step shows how to <a href="../delete-service/index">delete the service</a>.</p> +<p><a href="https://docs.docker.com/search/?q=tutorial">tutorial</a>, <a href="https://docs.docker.com/search/?q=cluster%20management">cluster management</a>, <a href="https://docs.docker.com/search/?q=swarm%20mode">swarm mode</a>, <a href="https://docs.docker.com/search/?q=scale">scale</a></p> +<div class="_attribution"> + <p class="_attribution-p"> + © 2019 Docker, Inc.<br>Licensed under the Apache License, Version 2.0.<br>Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>Docker, Inc. and other parties may also have trademark rights in other terms used herein.<br> + <a href="https://docs.docker.com/engine/swarm/swarm-tutorial/scale-service/" class="_attribution-link">https://docs.docker.com/engine/swarm/swarm-tutorial/scale-service/</a> + </p> +</div> |
