| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 | <h1>docker swarm leave</h1>  <p><br></p> <p>Leave the swarm</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 swarm leave [OPTIONS]
</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">When you run this command on a worker, that worker leaves the swarm.</p> <p>You can use the <code class="language-plaintext highlighter-rouge">--force</code> option on a manager to remove it from the swarm. However, this does not reconfigure the swarm to ensure that there are enough managers to maintain a quorum in the swarm. The safe way to remove a manager from a swarm is to demote it to a worker and then direct it to leave the quorum without using <code class="language-plaintext highlighter-rouge">--force</code>. Only use <code class="language-plaintext highlighter-rouge">--force</code> in situations where the swarm will no longer be used after the manager leaves, such as in a single-node swarm.</p> <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">--force</code> , <code class="language-plaintext highlighter-rouge">-f</code>
</td> <td></td> <td>Force this node to leave the swarm, ignoring warnings</td> </tr>  </tbody> </table>  <h2 id="examples">Examples</h2> <p>Consider the following swarm, as seen from the manager:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker node ls
ID                           HOSTNAME  STATUS  AVAILABILITY  MANAGER STATUS
7ln70fl22uw2dvjn2ft53m3q5    worker2   Ready   Active
dkp8vy1dq1kxleu9g4u78tlag    worker1   Ready   Active
dvfxp4zseq4s0rih1selh0d20 *  manager1  Ready   Active        Leader
</pre></div> <p>To remove <code class="language-plaintext highlighter-rouge">worker2</code>, issue the following command from <code class="language-plaintext highlighter-rouge">worker2</code> itself:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker swarm leave
Node left the default swarm.
</pre></div> <p>The node will still appear in the node list, and marked as <code class="language-plaintext highlighter-rouge">down</code>. It no longer affects swarm operation, but a long list of <code class="language-plaintext highlighter-rouge">down</code> nodes can clutter the node list. To remove an inactive node from the list, use the <a href="../node_rm/index"><code class="language-plaintext highlighter-rouge">node rm</code></a> command.</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="../swarm/index">docker swarm</a></td> <td style="text-align: left">Manage Swarm</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="../swarm_ca/index">docker swarm ca</a></td> <td>Display and rotate the root CA</td> </tr> <tr> <td><a href="../swarm_init/index">docker swarm init</a></td> <td>Initialize a swarm</td> </tr> <tr> <td><a href="../swarm_join/index">docker swarm join</a></td> <td>Join a swarm as a node and/or manager</td> </tr> <tr> <td><a href="../swarm_join-token/index">docker swarm join-token</a></td> <td>Manage join tokens</td> </tr> <tr> <td><a href="index">docker swarm leave</a></td> <td>Leave the swarm</td> </tr> <tr> <td><a href="../swarm_unlock/index">docker swarm unlock</a></td> <td>Unlock swarm</td> </tr> <tr> <td><a href="../swarm_unlock-key/index">docker swarm unlock-key</a></td> <td>Manage the unlock key</td> </tr> <tr> <td><a href="../swarm_update/index">docker swarm update</a></td> <td>Update the swarm</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/swarm_leave/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/swarm_leave/</a>
  </p>
</div>
 |