diff options
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fupdate%2Findex.html')
| -rw-r--r-- | devdocs/docker/engine%2Freference%2Fcommandline%2Fupdate%2Findex.html | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fupdate%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fupdate%2Findex.html new file mode 100644 index 00000000..b4cc7bec --- /dev/null +++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fupdate%2Findex.html @@ -0,0 +1,18 @@ +<h1>docker update</h1> <p><br></p> <p>Update configuration of one or more containers</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker update [OPTIONS] CONTAINER [CONTAINER...] +</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 <code class="language-plaintext highlighter-rouge">docker update</code> command dynamically updates container configuration. You can use this command to prevent containers from consuming too many resources from their Docker host. With a single command, you can place limits on a single container or on many. To specify more than one container, provide space-separated list of container names or IDs.</p> <p>With the exception of the <code class="language-plaintext highlighter-rouge">--kernel-memory</code> option, you can specify these options on a running or a stopped container. On kernel version older than 4.6, you can only update <code class="language-plaintext highlighter-rouge">--kernel-memory</code> on a stopped container or on a running container with kernel memory initialized.</p> <blockquote class="warning"> <p><strong>Warning</strong></p> <p>The <code class="language-plaintext highlighter-rouge">docker update</code> and <code class="language-plaintext highlighter-rouge">docker container update</code> commands are not supported for Windows containers.</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">--blkio-weight</code></td> <td></td> <td>Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--cpu-period</code></td> <td></td> <td>Limit CPU CFS (Completely Fair Scheduler) period</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--cpu-quota</code></td> <td></td> <td>Limit CPU CFS (Completely Fair Scheduler) quota</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--cpu-rt-period</code></td> <td></td> <td>Limit the CPU real-time period in microseconds</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--cpu-rt-runtime</code></td> <td></td> <td>Limit the CPU real-time runtime in microseconds</td> </tr> <tr> <td> +<code class="language-plaintext highlighter-rouge">--cpu-shares</code> , <code class="language-plaintext highlighter-rouge">-c</code> +</td> <td></td> <td>CPU shares (relative weight)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--cpus</code></td> <td></td> <td>Number of CPUs</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--cpuset-cpus</code></td> <td></td> <td>CPUs in which to allow execution (0-3, 0,1)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--cpuset-mems</code></td> <td></td> <td>MEMs in which to allow execution (0-3, 0,1)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--kernel-memory</code></td> <td></td> <td>Kernel memory limit</td> </tr> <tr> <td> +<code class="language-plaintext highlighter-rouge">--memory</code> , <code class="language-plaintext highlighter-rouge">-m</code> +</td> <td></td> <td>Memory limit</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--memory-reservation</code></td> <td></td> <td>Memory soft limit</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--memory-swap</code></td> <td></td> <td>Swap limit equal to memory plus swap: '-1' to enable unlimited swap</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--pids-limit</code></td> <td></td> <td> +<a href="https://docs.docker.com/engine/api/v1.40/" target="_blank" rel="noopener" class="_"><span class="badge badge-info" data-toggle="tooltip" title="Open the API reference (in a new window)">API 1.40+</span></a><br>Tune container pids limit (set -1 for unlimited)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--restart</code></td> <td></td> <td>Restart policy to apply when a container exits</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <p>The following sections illustrate ways to use this command.</p> <h3 id="update-a-containers-cpu-shares">Update a container’s cpu-shares</h3> <p>To limit a container’s cpu-shares to 512, first identify the container name or ID. You can use <code class="language-plaintext highlighter-rouge">docker ps</code> to find these values. You can also use the ID returned from the <code class="language-plaintext highlighter-rouge">docker run</code> command. Then, do the following:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker update --cpu-shares 512 abebf7571666 +</pre></div> <h3 id="update-a-container-with-cpu-shares-and-memory">Update a container with cpu-shares and memory</h3> <p>To update multiple resource configurations for multiple containers:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker update --cpu-shares 512 -m 300M abebf7571666 hopeful_morse +</pre></div> <h3 id="update-a-containers-kernel-memory-constraints">Update a container’s kernel memory constraints</h3> <p>You can update a container’s kernel memory limit using the <code class="language-plaintext highlighter-rouge">--kernel-memory</code> option. On kernel version older than 4.6, this option can be updated on a running container only if the container was started with <code class="language-plaintext highlighter-rouge">--kernel-memory</code>. If the container was started <em>without</em> <code class="language-plaintext highlighter-rouge">--kernel-memory</code> you need to stop the container before updating kernel memory.</p> <blockquote> <p><strong>Note</strong></p> <p>The <code class="language-plaintext highlighter-rouge">--kernel-memory</code> option has been deprecated since Docker 20.10.</p> </blockquote> <p>For example, if you started a container with this command:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker run -dit --name test --kernel-memory 50M ubuntu bash +</pre></div> <p>You can update kernel memory while the container is running:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker update --kernel-memory 80M test +</pre></div> <p>If you started a container <em>without</em> kernel memory initialized:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker run -dit --name test2 --memory 300M ubuntu bash +</pre></div> <p>Update kernel memory of running container <code class="language-plaintext highlighter-rouge">test2</code> will fail. You need to stop the container before updating the <code class="language-plaintext highlighter-rouge">--kernel-memory</code> setting. The next time you start it, the container uses the new value.</p> <p>Kernel version newer than (include) 4.6 does not have this limitation, you can use <code class="language-plaintext highlighter-rouge">--kernel-memory</code> the same way as other options.</p> <h3 id="update-a-containers-restart-policy">Update a container’s restart policy</h3> <p>You can change a container’s restart policy on a running container. The new restart policy takes effect instantly after you run <code class="language-plaintext highlighter-rouge">docker update</code> on a container.</p> <p>To update restart policy for one or more containers:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker update --restart=on-failure:3 abebf7571666 hopeful_morse +</pre></div> <p>Note that if the container is started with “--rm” flag, you cannot update the restart policy for it. The <code class="language-plaintext highlighter-rouge">AutoRemove</code> and <code class="language-plaintext highlighter-rouge">RestartPolicy</code> are mutually exclusive for the container.</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/reference/commandline/update/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/update/</a> + </p> +</div> |
