github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/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  # swarm leave
     8  
     9  ```markdown
    10  Usage:  docker swarm leave [OPTIONS]
    11  
    12  Leave the swarm
    13  
    14  Options:
    15    -f, --force   Force this node to leave the swarm, ignoring warnings
    16        --help    Print usage
    17  ```
    18  
    19  ## Description
    20  
    21  When you run this command on a worker, that worker leaves the swarm.
    22  
    23  You can use the `--force` option on a manager to remove it from the swarm.
    24  However, this does not reconfigure the swarm to ensure that there are enough
    25  managers to maintain a quorum in the swarm. The safe way to remove a manager
    26  from a swarm is to demote it to a worker and then direct it to leave the quorum
    27  without using `--force`. Only use `--force` in situations where the swarm will
    28  no longer be used after the manager leaves, such as in a single-node swarm.
    29  
    30  ## Examples
    31  
    32  Consider the following swarm, as seen from the manager:
    33  
    34  ```bash
    35  $ docker node ls
    36  
    37  ID                           HOSTNAME  STATUS  AVAILABILITY  MANAGER STATUS
    38  7ln70fl22uw2dvjn2ft53m3q5    worker2   Ready   Active
    39  dkp8vy1dq1kxleu9g4u78tlag    worker1   Ready   Active
    40  dvfxp4zseq4s0rih1selh0d20 *  manager1  Ready   Active        Leader
    41  ```
    42  
    43  To remove `worker2`, issue the following command from `worker2` itself:
    44  
    45  ```bash
    46  $ docker swarm leave
    47  
    48  Node left the default swarm.
    49  ```
    50  
    51  The node will still appear in the node list, and marked as `down`. It no longer
    52  affects swarm operation, but a long list of `down` nodes can clutter the node
    53  list. To remove an inactive node from the list, use the [`node rm`](node_rm.md)
    54  command.
    55  
    56  ## Related commands
    57  
    58  * [swarm ca](swarm_ca.md)
    59  * [node rm](node_rm.md)
    60  * [swarm init](swarm_init.md)
    61  * [swarm join](swarm_join.md)
    62  * [swarm join-token](swarm_join-token.md)
    63  * [swarm unlock](swarm_unlock.md)
    64  * [swarm unlock-key](swarm_unlock-key.md)
    65  * [swarm update](swarm_update.md)