1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<h1>docker service rollback</h1> <p><br></p> <p>Revert changes to a service’s configuration</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 rollback [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">Roll back a specified service to its previous version from the swarm.</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> <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> </tbody> </table> <h2 id="examples">Examples</h2> <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">docker service rollback</code> command to roll back to the previous version of a service. After executing this command, the service is reverted 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 creates a service with a single replica, updates the service to use three replicas, and then rolls back the service to the previous version, having one replica.</p> <p>Create a service with a single replica:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service create --name my-service -p 8080:80 nginx:alpine
</pre></div> <p>Confirm that the service is running with a single replica:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
xbw728mf6q0d my-service replicated 1/1 nginx:alpine *:8080->80/tcp
</pre></div> <p>Update the service to use three replicas:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service update --replicas=3 my-service
$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
xbw728mf6q0d my-service replicated 3/3 nginx:alpine *:8080->80/tcp
</pre></div> <p>Now roll back the service to its previous version, and confirm it is running a single replica again:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service rollback my-service
$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
xbw728mf6q0d my-service replicated 1/1 nginx:alpine *:8080->80/tcp
</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="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="../service_update/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_rollback/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/service_rollback/</a>
</p>
</div>
|