github.com/AliyunContainerService/cli@v0.0.0-20181009023821-814ced4b30d0/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/cli GitHub
     8       repository at https://github.com/docker/cli/. 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  ## Description
    29  
    30  When you run this command on a worker, that worker leaves the swarm.
    31  
    32  You can use the `--force` option on a manager to remove it from the swarm.
    33  However, this does not reconfigure the swarm to ensure that there are enough
    34  managers to maintain a quorum in the swarm. The safe way to remove a manager
    35  from a swarm is to demote it to a worker and then direct it to leave the quorum
    36  without using `--force`. Only use `--force` in situations where the swarm will
    37  no longer be used after the manager leaves, such as in a single-node swarm.
    38  
    39  ## Examples
    40  
    41  Consider the following swarm, as seen from the manager:
    42  
    43  ```bash
    44  $ docker node ls
    45  ID                           HOSTNAME  STATUS  AVAILABILITY  MANAGER STATUS
    46  7ln70fl22uw2dvjn2ft53m3q5    worker2   Ready   Active
    47  dkp8vy1dq1kxleu9g4u78tlag    worker1   Ready   Active
    48  dvfxp4zseq4s0rih1selh0d20 *  manager1  Ready   Active        Leader
    49  ```
    50  
    51  To remove `worker2`, issue the following command from `worker2` itself:
    52  
    53  ```bash
    54  $ docker swarm leave
    55  Node left the default swarm.
    56  ```
    57  
    58  The node will still appear in the node list, and marked as `down`. It no longer
    59  affects swarm operation, but a long list of `down` nodes can clutter the node
    60  list. To remove an inactive node from the list, use the [`node rm`](node_rm.md)
    61  command.
    62  
    63  ## Related commands
    64  
    65  * [swarm ca](swarm_ca.md)
    66  * [node rm](node_rm.md)
    67  * [swarm init](swarm_init.md)
    68  * [swarm join](swarm_join.md)
    69  * [swarm join-token](swarm_join_token.md)
    70  * [swarm unlock](swarm_unlock.md)
    71  * [swarm unlock-key](swarm_unlock_key.md)
    72  * [swarm update](swarm_update.md)