github.com/olljanat/moby@v1.13.1/docs/reference/commandline/swarm_leave.md (about)

     1  ---
     2  title: "swarm leave"
     3  description: "The swarm leave command description and usage"
     4  keywords: "swarm, leave"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # swarm leave
    17  
    18  ```markdown
    19  Usage:	docker swarm leave [OPTIONS]
    20  
    21  Leave the swarm
    22  
    23  Options:
    24    -f, --force   Force this node to leave the swarm, ignoring warnings
    25        --help    Print usage
    26  ```
    27  
    28  When you run this command on a worker, that worker leaves the swarm.
    29  
    30  You can use the `--force` option to on a manager to remove it from the swarm.
    31  However, this does not reconfigure the swarm to ensure that there are enough
    32  managers to maintain a quorum in the swarm. The safe way to remove a manager
    33  from a swarm is to demote it to a worker and then direct it to leave the quorum
    34  without using `--force`. Only use `--force` in situations where the swarm will
    35  no longer be used after the manager leaves, such as in a single-node swarm.
    36  
    37  Consider the following swarm, as seen from the manager:
    38  ```bash
    39  $ docker node ls
    40  ID                           HOSTNAME  STATUS  AVAILABILITY  MANAGER STATUS
    41  7ln70fl22uw2dvjn2ft53m3q5    worker2   Ready   Active
    42  dkp8vy1dq1kxleu9g4u78tlag    worker1   Ready   Active
    43  dvfxp4zseq4s0rih1selh0d20 *  manager1  Ready   Active        Leader
    44  ```
    45  
    46  To remove `worker2`, issue the following command from `worker2` itself:
    47  ```bash
    48  $ docker swarm leave
    49  Node left the default swarm.
    50  ```
    51  To remove an inactive node, use the [`node rm`](node_rm.md) command instead.
    52  
    53  ## Related information
    54  
    55  * [node rm](node_rm.md)
    56  * [swarm init](swarm_init.md)
    57  * [swarm join](swarm_join.md)
    58  * [swarm update](swarm_update.md)