summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html
new repository
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html')
-rw-r--r--devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html35
1 files changed, 35 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html
new file mode 100644
index 00000000..c3779db1
--- /dev/null
+++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html
@@ -0,0 +1,35 @@
+<h1>docker service scale</h1> <p><br></p> <p>Scale one or multiple replicated services</p> <p><span class="badge badge-info" data-toggle="tooltip" data-placement="right" title="This command works with the Swarm orchestrator.">Swarm</span> This command works with the Swarm orchestrator.</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker service scale SERVICE=REPLICAS [SERVICE=REPLICAS...]
+</pre></div> <p>Refer to the <a href="#options">options section</a> for an overview of available <a href="#options"><code class="language-plaintext highlighter-rouge">OPTIONS</code></a> for this command.</p> <h2 id="description">Description</h2> <p name="extended-description">The scale command enables you to scale one or more replicated services either up or down to the desired number of replicas. This command cannot be applied on services which are global mode. The command will return immediately, but the actual scaling of the service may take some time. To stop all replicas of a service while keeping the service active in the swarm you can set the scale to 0.</p> <blockquote> <p><strong>Note</strong></p> <p>This is a cluster management command, and must be executed on a swarm manager node. To learn about managers and workers, refer to the <a href="../../../swarm/index">Swarm mode section</a> in the documentation.</p> </blockquote> <p>For example uses of this command, refer to the <a href="#examples">examples section</a> below.</p> <h2 id="options">Options</h2> <table> <thead> <tr> <td>Name, shorthand</td> <td>Default</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td>
+<code class="language-plaintext highlighter-rouge">--detach</code> , <code class="language-plaintext highlighter-rouge">-d</code>
+</td> <td></td> <td>Exit immediately instead of waiting for the service to converge</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <h3 id="scale-a-single-service">Scale a single service</h3> <p>The following command scales the “frontend” service to 50 tasks.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service scale frontend=50
+
+frontend scaled to 50
+</pre></div> <p>The following command tries to scale a global service to 10 tasks and returns an error.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service create --mode global --name backend backend:latest
+
+b4g08uwuairexjub6ome6usqh
+
+$ docker service scale backend=10
+
+backend: scale can only be used with replicated or replicated-job mode
+</pre></div> <p>Directly afterwards, run <code class="language-plaintext highlighter-rouge">docker service ls</code>, to see the actual number of replicas.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ls --filter name=frontend
+
+ID NAME MODE REPLICAS IMAGE
+3pr5mlvu3fh9 frontend replicated 15/50 nginx:alpine
+</pre></div> <p>You can also scale a service using the <a href="../service_update/index"><code class="language-plaintext highlighter-rouge">docker service update</code></a> command. The following commands are equivalent:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service scale frontend=50
+$ docker service update --replicas=50 frontend
+</pre></div> <h3 id="scale-multiple-services">Scale multiple services</h3> <p>The <code class="language-plaintext highlighter-rouge">docker service scale</code> command allows you to set the desired number of tasks for multiple services at once. The following example scales both the backend and frontend services:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service scale backend=3 frontend=5
+
+backend scaled to 3
+frontend scaled to 5
+
+$ docker service ls
+
+ID NAME MODE REPLICAS IMAGE
+3pr5mlvu3fh9 frontend replicated 5/5 nginx:alpine
+74nzcxxjv6fq backend replicated 3/3 redis:3.0.6
+</pre></div> <h2 id="parent-command">Parent command</h2> <table> <thead> <tr> <th style="text-align: left">Command</th> <th style="text-align: left">Description</th> </tr> </thead> <tbody> <tr> <td style="text-align: left"><a href="../service/index">docker service</a></td> <td style="text-align: left">Manage services</td> </tr> </tbody> </table> <h2 id="related-commands">Related commands</h2> <table> <thead> <tr> <td>Command</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td><a href="../service_create/index">docker service create</a></td> <td>Create a new service</td> </tr> <tr> <td><a href="../service_inspect/index">docker service inspect</a></td> <td>Display detailed information on one or more services</td> </tr> <tr> <td><a href="../service_logs/index">docker service logs</a></td> <td>Fetch the logs of a service or task</td> </tr> <tr> <td><a href="../service_ls/index">docker service ls</a></td> <td>List services</td> </tr> <tr> <td><a href="../service_ps/index">docker service ps</a></td> <td>List the tasks of one or more services</td> </tr> <tr> <td><a href="../service_rm/index">docker service rm</a></td> <td>Remove one or more services</td> </tr> <tr> <td><a href="../service_rollback/index">docker service rollback</a></td> <td>Revert changes to a service’s configuration</td> </tr> <tr> <td><a href="index">docker service scale</a></td> <td>Scale one or multiple replicated services</td> </tr> <tr> <td><a href="../service_update/index">docker service update</a></td> <td>Update a service</td> </tr> </tbody> </table> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 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/reference/commandline/service_scale/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/service_scale/</a>
+ </p>
+</div>