...

Text file src/github.com/docker/cli/docs/reference/commandline/swarm_leave.md

Documentation: github.com/docker/cli/docs/reference/commandline

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

View as plain text