2016-10-14 18:30:36 -04:00
|
|
|
---
|
|
|
|
title: "node rm"
|
|
|
|
description: "The node rm command description and usage"
|
2016-11-03 18:48:30 -04:00
|
|
|
keywords: "node, remove"
|
2016-10-14 18:30:36 -04:00
|
|
|
---
|
2016-06-13 22:57:19 -04:00
|
|
|
|
|
|
|
# node rm
|
|
|
|
|
2016-07-07 14:43:18 -04:00
|
|
|
```markdown
|
2020-10-02 09:51:01 -04:00
|
|
|
Usage: docker node rm [OPTIONS] NODE [NODE...]
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2016-07-29 13:41:52 -04:00
|
|
|
Remove one or more nodes from the swarm
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2016-07-07 14:43:18 -04:00
|
|
|
Aliases:
|
|
|
|
rm, remove
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2016-07-07 14:43:18 -04:00
|
|
|
Options:
|
2016-11-09 01:22:06 -05:00
|
|
|
-f, --force Force remove a node from the swarm
|
|
|
|
--help Print usage
|
2016-07-07 14:43:18 -04:00
|
|
|
```
|
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
## Description
|
|
|
|
|
2018-12-23 06:27:52 -05:00
|
|
|
Removes the specified nodes from a swarm.
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2020-04-19 11:08:37 -04:00
|
|
|
> **Note**
|
|
|
|
>
|
|
|
|
> This is a cluster management command, and must be executed on a swarm
|
|
|
|
> manager node. To learn about managers and workers, refer to the
|
|
|
|
> [Swarm mode section](https://docs.docker.com/engine/swarm/) in the
|
|
|
|
> documentation.
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
### Remove a stopped node from the swarm
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2021-08-21 08:54:14 -04:00
|
|
|
```console
|
2016-09-01 18:38:25 -04:00
|
|
|
$ docker node rm swarm-node-02
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2016-09-01 18:38:25 -04:00
|
|
|
Node swarm-node-02 removed from swarm
|
|
|
|
```
|
2021-08-21 08:54:14 -04:00
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
### Attempt to remove a running node from a swarm
|
2016-09-01 18:38:25 -04:00
|
|
|
|
|
|
|
Removes the specified nodes from the swarm, but only if the nodes are in the
|
|
|
|
down state. If you attempt to remove an active node you will receive an error:
|
2016-07-28 00:17:00 -04:00
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
```non
|
2016-07-28 00:17:00 -04:00
|
|
|
$ docker node rm swarm-node-03
|
2016-09-01 18:38:25 -04:00
|
|
|
|
|
|
|
Error response from daemon: rpc error: code = 9 desc = node swarm-node-03 is not
|
|
|
|
down and can't be removed
|
2016-07-28 00:17:00 -04:00
|
|
|
```
|
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
### Forcibly remove an inaccessible node from a swarm
|
|
|
|
|
2016-09-01 18:38:25 -04:00
|
|
|
If you lose access to a worker node or need to shut it down because it has been
|
|
|
|
compromised or is not behaving as expected, you can use the `--force` option.
|
|
|
|
This may cause transient errors or interruptions, depending on the type of task
|
|
|
|
being run on the node.
|
2016-07-28 00:17:00 -04:00
|
|
|
|
2021-08-21 08:54:14 -04:00
|
|
|
```console
|
2016-07-28 00:17:00 -04:00
|
|
|
$ docker node rm --force swarm-node-03
|
2016-09-01 18:38:25 -04:00
|
|
|
|
2016-07-28 00:17:00 -04:00
|
|
|
Node swarm-node-03 removed from swarm
|
|
|
|
```
|
|
|
|
|
2016-09-01 18:38:25 -04:00
|
|
|
A manager node must be demoted to a worker node (using `docker node demote`)
|
|
|
|
before you can remove it from the swarm.
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
## Related commands
|
2016-06-13 22:57:19 -04:00
|
|
|
|
2016-09-01 18:38:25 -04:00
|
|
|
* [node demote](node_demote.md)
|
2016-12-13 09:15:08 -05:00
|
|
|
* [node inspect](node_inspect.md)
|
2016-06-13 22:57:19 -04:00
|
|
|
* [node ls](node_ls.md)
|
2016-12-13 09:15:08 -05:00
|
|
|
* [node promote](node_promote.md)
|
|
|
|
* [node ps](node_ps.md)
|
|
|
|
* [node update](node_update.md)
|