2016-06-13 22:57:19 -04:00
|
|
|
<!--[metadata]>
|
|
|
|
+++
|
|
|
|
title = "swarm leave"
|
|
|
|
description = "The swarm leave command description and usage"
|
|
|
|
keywords = ["swarm, leave"]
|
|
|
|
[menu.main]
|
|
|
|
parent = "smn_cli"
|
|
|
|
+++
|
|
|
|
<![end-metadata]-->
|
|
|
|
|
|
|
|
# swarm leave
|
|
|
|
|
2016-07-07 14:43:18 -04:00
|
|
|
```markdown
|
|
|
|
Usage: docker swarm leave [OPTIONS]
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2016-09-01 18:38:25 -04:00
|
|
|
Leave the swarm (workers only).
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2016-07-07 14:43:18 -04:00
|
|
|
Options:
|
2016-09-01 18:38:25 -04:00
|
|
|
--force Force this node to leave the swarm, ignoring warnings
|
2016-07-07 14:43:18 -04:00
|
|
|
--help Print usage
|
|
|
|
```
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2016-09-01 18:38:25 -04:00
|
|
|
When you run this command on a worker, that worker leaves the swarm.
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2016-09-01 18:38:25 -04:00
|
|
|
You can use the `--force` option to on a manager to remove it from the swarm.
|
|
|
|
However, this does not reconfigure the swarm to ensure that there are enough
|
|
|
|
managers to maintain a quorum in the swarm. The safe way to remove a manager
|
|
|
|
from a swarm is to demote it to a worker and then direct it to leave the quorum
|
|
|
|
without using `--force`. Only use `--force` in situations where the swarm will
|
|
|
|
no longer be used after the manager leaves, such as in a single-node swarm.
|
|
|
|
|
|
|
|
Consider the following swarm, as seen from the manager:
|
2016-06-13 22:57:19 -04:00
|
|
|
```bash
|
|
|
|
$ docker node ls
|
2016-07-20 14:15:08 -04:00
|
|
|
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
|
|
|
7ln70fl22uw2dvjn2ft53m3q5 worker2 Ready Active
|
2016-09-01 18:38:25 -04:00
|
|
|
dkp8vy1dq1kxleu9g4u78tlag worker1 Ready Active
|
2016-07-20 14:15:08 -04:00
|
|
|
dvfxp4zseq4s0rih1selh0d20 * manager1 Ready Active Leader
|
2016-06-13 22:57:19 -04:00
|
|
|
```
|
|
|
|
|
2016-09-01 18:38:25 -04:00
|
|
|
To remove `worker2`, issue the following command from `worker2` itself:
|
2016-06-13 22:57:19 -04:00
|
|
|
```bash
|
|
|
|
$ docker swarm leave
|
|
|
|
Node left the default swarm.
|
|
|
|
```
|
2016-09-28 23:19:00 -04:00
|
|
|
To remove an inactive node, use the [`node rm`](node_rm.md) command instead.
|
2016-06-13 22:57:19 -04:00
|
|
|
|
|
|
|
## Related information
|
|
|
|
|
2016-09-01 18:38:25 -04:00
|
|
|
* [node rm](node_rm.md)
|
2016-06-13 22:57:19 -04:00
|
|
|
* [swarm init](swarm_init.md)
|
|
|
|
* [swarm join](swarm_join.md)
|
|
|
|
* [swarm update](swarm_update.md)
|