diff options
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_update%2Findex.html')
| -rw-r--r-- | devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_update%2Findex.html | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_update%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_update%2Findex.html new file mode 100644 index 00000000..ee684a4a --- /dev/null +++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_update%2Findex.html @@ -0,0 +1,83 @@ +<h1>docker service update</h1> <p><br></p> <p>Update a service</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 update [OPTIONS] SERVICE +</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">Updates a service as described by the specified parameters. The parameters are the same as <a href="../service_create/index"><code class="language-plaintext highlighter-rouge">docker service create</code></a>. Refer to the description there for further information.</p> <p>Normally, updating a service will only cause the service’s tasks to be replaced with new ones if a change to the service requires recreating the tasks for it to take effect. For example, only changing the <code class="language-plaintext highlighter-rouge">--update-parallelism</code> setting will not recreate the tasks, because the individual tasks are not affected by this setting. However, the <code class="language-plaintext highlighter-rouge">--force</code> flag will cause the tasks to be recreated anyway. This can be used to perform a rolling restart without any changes to the service parameters.</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">--args</code></td> <td></td> <td>Service command args</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--cap-add</code></td> <td></td> <td> +<a href="https://docs.docker.com/engine/api/v1.41/" target="_blank" rel="noopener" class="_"><span class="badge badge-info" data-toggle="tooltip" title="Open the 1.24 API reference (in a new window)">API 1.41+</span></a><br>Add Linux capabilities</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--cap-drop</code></td> <td></td> <td> +<a href="https://docs.docker.com/engine/api/v1.41/" target="_blank" rel="noopener" class="_"><span class="badge badge-info" data-toggle="tooltip" title="Open the 1.24 API reference (in a new window)">API 1.41+</span></a><br>Drop Linux capabilities</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--config-add</code></td> <td></td> <td> +<a href="https://docs.docker.com/engine/api/v1.41/" target="_blank" rel="noopener" class="_"><span class="badge badge-info" data-toggle="tooltip" title="Open the 1.24 API reference (in a new window)">API 1.41+</span></a><br>Add or update a config file on a service</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--config-rm</code></td> <td></td> <td> +<a href="https://docs.docker.com/engine/api/v1.41/" target="_blank" rel="noopener" class="_"><span class="badge badge-info" data-toggle="tooltip" title="Open the 1.24 API reference (in a new window)">API 1.41+</span></a><br>Remove a configuration file</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--constraint-add</code></td> <td></td> <td>Add or update a placement constraint</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--constraint-rm</code></td> <td></td> <td>Remove a constraint</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--container-label-add</code></td> <td></td> <td>Add or update a container label</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--container-label-rm</code></td> <td></td> <td>Remove a container label by its key</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--credential-spec</code></td> <td></td> <td>Credential spec for managed service account (Windows only)</td> </tr> <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> <tr> <td><code class="language-plaintext highlighter-rouge">--dns-add</code></td> <td></td> <td>Add or update a custom DNS server</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--dns-option-add</code></td> <td></td> <td>Add or update a DNS option</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--dns-option-rm</code></td> <td></td> <td>Remove a DNS option</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--dns-rm</code></td> <td></td> <td>Remove a custom DNS server</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--dns-search-add</code></td> <td></td> <td>Add or update a custom DNS search domain</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--dns-search-rm</code></td> <td></td> <td>Remove a DNS search domain</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--endpoint-mode</code></td> <td></td> <td>Endpoint mode (vip or dnsrr)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--entrypoint</code></td> <td></td> <td>Overwrite the default ENTRYPOINT of the image</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--env-add</code></td> <td></td> <td>Add or update an environment variable</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--env-rm</code></td> <td></td> <td>Remove an environment variable</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--force</code></td> <td></td> <td>Force update even if no changes require it</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--generic-resource-add</code></td> <td></td> <td>Add a Generic resource</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--generic-resource-rm</code></td> <td></td> <td>Remove a Generic resource</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--group-add</code></td> <td></td> <td>Add an additional supplementary user group to the container</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--group-rm</code></td> <td></td> <td>Remove a previously added supplementary user group from the container</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--health-cmd</code></td> <td></td> <td>Command to run to check health</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--health-interval</code></td> <td></td> <td>Time between running the check (ms|s|m|h)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--health-retries</code></td> <td></td> <td>Consecutive failures needed to report unhealthy</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--health-start-period</code></td> <td></td> <td>Start period for the container to initialize before counting retries towards unstable (ms|s|m|h)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--health-timeout</code></td> <td></td> <td>Maximum time to allow one check to run (ms|s|m|h)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--host-add</code></td> <td></td> <td>Add a custom host-to-IP mapping (host:ip)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--host-rm</code></td> <td></td> <td>Remove a custom host-to-IP mapping (host:ip)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--hostname</code></td> <td></td> <td>Container hostname</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--image</code></td> <td></td> <td>Service image tag</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--init</code></td> <td></td> <td>Use an init inside each service container to forward signals and reap processes</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--isolation</code></td> <td></td> <td>Service container isolation mode</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--label-add</code></td> <td></td> <td>Add or update a service label</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--label-rm</code></td> <td></td> <td>Remove a label by its key</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--limit-cpu</code></td> <td></td> <td>Limit CPUs</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--limit-memory</code></td> <td></td> <td>Limit Memory</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--limit-pids</code></td> <td></td> <td> +<a href="https://docs.docker.com/engine/api/v1.41/" target="_blank" rel="noopener" class="_"><span class="badge badge-info" data-toggle="tooltip" title="Open the 1.24 API reference (in a new window)">API 1.41+</span></a><span class="badge badge-info" data-toggle="tooltip" title="This option works for the Swarm orchestrator.">Swarm</span><br>Limit maximum number of processes (default 0 = unlimited)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--log-driver</code></td> <td></td> <td>Logging driver for service</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--log-opt</code></td> <td></td> <td>Logging driver options</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--max-concurrent</code></td> <td></td> <td> +<a href="https://docs.docker.com/engine/api/v1.41/" target="_blank" rel="noopener" class="_"><span class="badge badge-info" data-toggle="tooltip" title="Open the 1.24 API reference (in a new window)">API 1.41+</span></a><br>Number of job tasks to run concurrently (default equal to --replicas)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--mount-add</code></td> <td></td> <td>Add or update a mount on a service</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--mount-rm</code></td> <td></td> <td>Remove a mount by its target path</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--network-add</code></td> <td></td> <td>Add a network</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--network-rm</code></td> <td></td> <td>Remove a network</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--no-healthcheck</code></td> <td></td> <td>Disable any container-specified HEALTHCHECK</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--no-resolve-image</code></td> <td></td> <td>Do not query the registry to resolve image digest and supported platforms</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--placement-pref-add</code></td> <td></td> <td>Add a placement preference</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--placement-pref-rm</code></td> <td></td> <td>Remove a placement preference</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--publish-add</code></td> <td></td> <td>Add or update a published port</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--publish-rm</code></td> <td></td> <td>Remove a published port by its target port</td> </tr> <tr> <td> +<code class="language-plaintext highlighter-rouge">--quiet</code> , <code class="language-plaintext highlighter-rouge">-q</code> +</td> <td></td> <td>Suppress progress output</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--read-only</code></td> <td></td> <td>Mount the container's root filesystem as read only</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--replicas</code></td> <td></td> <td>Number of tasks</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--replicas-max-per-node</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 1.24 API reference (in a new window)">API 1.40+</span></a><br>Maximum number of tasks per node (default 0 = unlimited)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--reserve-cpu</code></td> <td></td> <td>Reserve CPUs</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--reserve-memory</code></td> <td></td> <td>Reserve Memory</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--restart-condition</code></td> <td></td> <td>Restart when condition is met ("none"|"on-failure"|"any")</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--restart-delay</code></td> <td></td> <td>Delay between restart attempts (ns|us|ms|s|m|h)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--restart-max-attempts</code></td> <td></td> <td>Maximum number of restarts before giving up</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--restart-window</code></td> <td></td> <td>Window used to evaluate the restart policy (ns|us|ms|s|m|h)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--rollback</code></td> <td></td> <td>Rollback to previous specification</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--rollback-delay</code></td> <td></td> <td>Delay between task rollbacks (ns|us|ms|s|m|h)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--rollback-failure-action</code></td> <td></td> <td>Action on rollback failure ("pause"|"continue")</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--rollback-max-failure-ratio</code></td> <td></td> <td>Failure rate to tolerate during a rollback</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--rollback-monitor</code></td> <td></td> <td>Duration after each task rollback to monitor for failure (ns|us|ms|s|m|h)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--rollback-order</code></td> <td></td> <td>Rollback order ("start-first"|"stop-first")</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--rollback-parallelism</code></td> <td></td> <td>Maximum number of tasks rolled back simultaneously (0 to roll back all at once)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--secret-add</code></td> <td></td> <td>Add or update a secret on a service</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--secret-rm</code></td> <td></td> <td>Remove a secret</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--stop-grace-period</code></td> <td></td> <td>Time to wait before force killing a container (ns|us|ms|s|m|h)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--stop-signal</code></td> <td></td> <td>Signal to stop the container</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--sysctl-add</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 1.24 API reference (in a new window)">API 1.40+</span></a><br>Add or update a Sysctl option</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--sysctl-rm</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 1.24 API reference (in a new window)">API 1.40+</span></a><br>Remove a Sysctl option</td> </tr> <tr> <td> +<code class="language-plaintext highlighter-rouge">--tty</code> , <code class="language-plaintext highlighter-rouge">-t</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 1.24 API reference (in a new window)">API 1.40+</span></a><br>Allocate a pseudo-TTY</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--ulimit-add</code></td> <td></td> <td> +<a href="https://docs.docker.com/engine/api/v1.41/" target="_blank" rel="noopener" class="_"><span class="badge badge-info" data-toggle="tooltip" title="Open the 1.24 API reference (in a new window)">API 1.41+</span></a><br>Add or update a ulimit option</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--ulimit-rm</code></td> <td></td> <td> +<a href="https://docs.docker.com/engine/api/v1.41/" target="_blank" rel="noopener" class="_"><span class="badge badge-info" data-toggle="tooltip" title="Open the 1.24 API reference (in a new window)">API 1.41+</span></a><br>Remove a ulimit option</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--update-delay</code></td> <td></td> <td>Delay between updates (ns|us|ms|s|m|h)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--update-failure-action</code></td> <td></td> <td>Action on update failure ("pause"|"continue"|"rollback")</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--update-max-failure-ratio</code></td> <td></td> <td>Failure rate to tolerate during an update</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--update-monitor</code></td> <td></td> <td>Duration after each task update to monitor for failure (ns|us|ms|s|m|h)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--update-order</code></td> <td></td> <td>Update order ("start-first"|"stop-first")</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--update-parallelism</code></td> <td></td> <td>Maximum number of tasks updated simultaneously (0 to update all at once)</td> </tr> <tr> <td> +<code class="language-plaintext highlighter-rouge">--user</code> , <code class="language-plaintext highlighter-rouge">-u</code> +</td> <td></td> <td>Username or UID (format: <name|uid>[:<group|gid>])</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--with-registry-auth</code></td> <td></td> <td>Send registry authentication details to swarm agents</td> </tr> <tr> <td> +<code class="language-plaintext highlighter-rouge">--workdir</code> , <code class="language-plaintext highlighter-rouge">-w</code> +</td> <td></td> <td>Working directory inside the container</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <h3 id="update-a-service">Update a service</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker service update --limit-cpu 2 redis +</pre></div> <h3 id="perform-a-rolling-restart-with-no-parameter-changes">Perform a rolling restart with no parameter changes</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker service update --force --update-parallelism 1 --update-delay 30s redis +</pre></div> <p>In this example, the <code class="language-plaintext highlighter-rouge">--force</code> flag causes the service’s tasks to be shut down and replaced with new ones even though none of the other parameters would normally cause that to happen. The <code class="language-plaintext highlighter-rouge">--update-parallelism 1</code> setting ensures that only one task is replaced at a time (this is the default behavior). The <code class="language-plaintext highlighter-rouge">--update-delay 30s</code> setting introduces a 30 second delay between tasks, so that the rolling restart happens gradually.</p> <h3 id="add-or-remove-mounts">Add or remove mounts</h3> <p>Use the <code class="language-plaintext highlighter-rouge">--mount-add</code> or <code class="language-plaintext highlighter-rouge">--mount-rm</code> options add or remove a service’s bind mounts or volumes.</p> <p>The following example creates a service which mounts the <code class="language-plaintext highlighter-rouge">test-data</code> volume to <code class="language-plaintext highlighter-rouge">/somewhere</code>. The next step updates the service to also mount the <code class="language-plaintext highlighter-rouge">other-volume</code> volume to <code class="language-plaintext highlighter-rouge">/somewhere-else</code>volume, The last step unmounts the <code class="language-plaintext highlighter-rouge">/somewhere</code> mount point, effectively removing the <code class="language-plaintext highlighter-rouge">test-data</code> volume. Each command returns the service name.</p> <ul> <li> <p>The <code class="language-plaintext highlighter-rouge">--mount-add</code> flag takes the same parameters as the <code class="language-plaintext highlighter-rouge">--mount</code> flag on <code class="language-plaintext highlighter-rouge">service create</code>. Refer to the <a href="../service_create/index#add-bind-mounts-volumes-or-memory-filesystems">volumes and bind mounts</a> section in the <code class="language-plaintext highlighter-rouge">service create</code> reference for details.</p> </li> <li> <p>The <code class="language-plaintext highlighter-rouge">--mount-rm</code> flag takes the <code class="language-plaintext highlighter-rouge">target</code> path of the mount.</p> </li> </ul> <div class="highlight"><pre class="highlight" data-language="">$ docker service create \ + --name=myservice \ + --mount type=volume,source=test-data,target=/somewhere \ + nginx:alpine + +myservice + +$ docker service update \ + --mount-add type=volume,source=other-volume,target=/somewhere-else \ + myservice + +myservice + +$ docker service update --mount-rm /somewhere myservice + +myservice +</pre></div> <h3 id="add-or-remove-published-service-ports">Add or remove published service ports</h3> <p>Use the <code class="language-plaintext highlighter-rouge">--publish-add</code> or <code class="language-plaintext highlighter-rouge">--publish-rm</code> flags to add or remove a published port for a service. You can use the short or long syntax discussed in the <a href="../service_create/index#publish-service-ports-externally-to-the-swarm--p---publish">docker service create</a> reference.</p> <p>The following example adds a published service port to an existing service.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service update \ + --publish-add published=8080,target=80 \ + myservice +</pre></div> <h3 id="add-or-remove-network">Add or remove network</h3> <p>Use the <code class="language-plaintext highlighter-rouge">--network-add</code> or <code class="language-plaintext highlighter-rouge">--network-rm</code> flags to add or remove a network for a service. You can use the short or long syntax discussed in the <a href="../service_create/index#attach-a-service-to-an-existing-network---network">docker service create</a> reference.</p> <p>The following example adds a new alias name to an existing service already connected to network my-network:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service update \ + --network-rm my-network \ + --network-add name=my-network,alias=web1 \ + myservice +</pre></div> <h3 id="roll-back-to-the-previous-version-of-a-service">Roll back to the previous version of a service</h3> <p>Use the <code class="language-plaintext highlighter-rouge">--rollback</code> option to roll back to the previous version of the service.</p> <p>This will revert the service to the configuration that was in place before the most recent <code class="language-plaintext highlighter-rouge">docker service update</code> command.</p> <p>The following example updates the number of replicas for the service from 4 to 5, and then rolls back to the previous configuration.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service update --replicas=5 web + +web + +$ docker service ls + +ID NAME MODE REPLICAS IMAGE +80bvrzp6vxf3 web replicated 0/5 nginx:alpine + +</pre></div> <p>Roll back the <code class="language-plaintext highlighter-rouge">web</code> service...</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service update --rollback web + +web + +$ docker service ls + +ID NAME MODE REPLICAS IMAGE +80bvrzp6vxf3 web replicated 0/4 nginx:alpine + +</pre></div> <p>Other options can be combined with <code class="language-plaintext highlighter-rouge">--rollback</code> as well, for example, <code class="language-plaintext highlighter-rouge">--update-delay 0s</code> to execute the rollback without a delay between tasks:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service update \ + --rollback \ + --update-delay 0s + web + +web + +</pre></div> <p>Services can also be set up to roll back to the previous version automatically when an update fails. To set up a service for automatic rollback, use <code class="language-plaintext highlighter-rouge">--update-failure-action=rollback</code>. A rollback will be triggered if the fraction of the tasks which failed to update successfully exceeds the value given with <code class="language-plaintext highlighter-rouge">--update-max-failure-ratio</code>.</p> <p>The rate, parallelism, and other parameters of a rollback operation are determined by the values passed with the following flags:</p> <ul> <li><code class="language-plaintext highlighter-rouge">--rollback-delay</code></li> <li><code class="language-plaintext highlighter-rouge">--rollback-failure-action</code></li> <li><code class="language-plaintext highlighter-rouge">--rollback-max-failure-ratio</code></li> <li><code class="language-plaintext highlighter-rouge">--rollback-monitor</code></li> <li><code class="language-plaintext highlighter-rouge">--rollback-parallelism</code></li> </ul> <p>For example, a service set up with <code class="language-plaintext highlighter-rouge">--update-parallelism 1 --rollback-parallelism 3</code> will update one task at a time during a normal update, but during a rollback, 3 tasks at a time will get rolled back. These rollback parameters are respected both during automatic rollbacks and for rollbacks initiated manually using <code class="language-plaintext highlighter-rouge">--rollback</code>.</p> <h3 id="add-or-remove-secrets">Add or remove secrets</h3> <p>Use the <code class="language-plaintext highlighter-rouge">--secret-add</code> or <code class="language-plaintext highlighter-rouge">--secret-rm</code> options add or remove a service’s secrets.</p> <p>The following example adds a secret named <code class="language-plaintext highlighter-rouge">ssh-2</code> and removes <code class="language-plaintext highlighter-rouge">ssh-1</code>:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service update \ + --secret-add source=ssh-2,target=ssh-2 \ + --secret-rm ssh-1 \ + myservice +</pre></div> <h3 id="update-services-using-templates">Update services using templates</h3> <p>Some flags of <code class="language-plaintext highlighter-rouge">service update</code> support the use of templating. See <a href="../service_create/index#create-services-using-templates"><code class="language-plaintext highlighter-rouge">service create</code></a> for the reference.</p> <h3 id="specify-isolation-mode-windows">Specify isolation mode (Windows)</h3> <p><code class="language-plaintext highlighter-rouge">service update</code> supports the same <code class="language-plaintext highlighter-rouge">--isolation</code> flag as <code class="language-plaintext highlighter-rouge">service create</code> See <a href="../service_create/index"><code class="language-plaintext highlighter-rouge">service create</code></a> for the reference.</p> <h3 id="updating-jobs">Updating Jobs</h3> <p>When a service is created as a job, by setting its mode to <code class="language-plaintext highlighter-rouge">replicated-job</code> or to <code class="language-plaintext highlighter-rouge">global-job</code> when doing <code class="language-plaintext highlighter-rouge">service create</code>, options for updating it are limited.</p> <p>Updating a Job immediately stops any Tasks that are in progress. The operation creates a new set of Tasks for the job and effectively resets its completion status. If any Tasks were running before the update, they are stopped, and new Tasks are created.</p> <p>Jobs cannot be rolled out or rolled back. None of the flags for configuring update or rollback settings are valid with job modes.</p> <p>To run a job again with the same parameters that it was run previously, it can be force updated with the <code class="language-plaintext highlighter-rouge">--force</code> flag.</p> <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="../service_scale/index">docker service scale</a></td> <td>Scale one or multiple replicated services</td> </tr> <tr> <td><a href="index">docker service update</a></td> <td>Update a service</td> </tr> </tbody> </table> <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/service_update/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/service_update/</a> + </p> +</div> |
