github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/docs/reference/commandline/swarm_leave.md (about) 1 # swarm leave 2 3 <!---MARKER_GEN_START--> 4 Leave 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 17 When you run this command on a worker, that worker leaves the swarm. 18 19 You can use the `--force` option on a manager to remove it from the swarm. 20 However, this does not reconfigure the swarm to ensure that there are enough 21 managers to maintain a quorum in the swarm. The safe way to remove a manager 22 from a swarm is to demote it to a worker and then direct it to leave the quorum 23 without using `--force`. Only use `--force` in situations where the swarm will 24 no longer be used after the manager leaves, such as in a single-node swarm. 25 26 ## Examples 27 28 Consider the following swarm, as seen from the manager: 29 30 ```console 31 $ docker node ls 32 33 ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 34 7ln70fl22uw2dvjn2ft53m3q5 worker2 Ready Active 35 dkp8vy1dq1kxleu9g4u78tlag worker1 Ready Active 36 dvfxp4zseq4s0rih1selh0d20 * manager1 Ready Active Leader 37 ``` 38 39 To remove `worker2`, issue the following command from `worker2` itself: 40 41 ```console 42 $ docker swarm leave 43 44 Node left the default swarm. 45 ``` 46 47 The node will still appear in the node list, and marked as `down`. It no longer 48 affects swarm operation, but a long list of `down` nodes can clutter the node 49 list. To remove an inactive node from the list, use the [`node rm`](node_rm.md) 50 command. 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)