docker node rm
Description
Remove one or more nodes from the swarm
API 1.24+
The client and daemon API must both be at least
1.24
to use this command. Use the docker version
command on the client to check
your client and daemon API versions.
Swarm This command works with the Swarm orchestrator.
Usage
docker node rm [OPTIONS] NODE [NODE...]
Extended description
Removes the specified nodes from a swarm.
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 in the documentation.
For example uses of this command, refer to the examples section below.
Options
Name, shorthand | Default | Description |
--force , -f |
Force remove a node from the swarm |
Examples
Remove a stopped node from the swarm
$ docker node rm swarm-node-02
Node swarm-node-02 removed from swarm
Attempt to remove a running node from a swarm
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:
$ docker node rm swarm-node-03
Error response from daemon: rpc error: code = 9 desc = node swarm-node-03 is not
down and can't be removed
Forcibly remove an inaccessible node from a swarm
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.
$ docker node rm --force swarm-node-03
Node swarm-node-03 removed from swarm
A manager node must be demoted to a worker node (using docker node demote
)
before you can remove it from the swarm.
Parent command
Command | Description |
---|---|
docker node | Manage Swarm nodes |
Related commands
Command | Description |
docker node demote | Demote one or more nodes from manager in the swarm |
docker node inspect | Display detailed information on one or more nodes |
docker node ls | List nodes in the swarm |
docker node promote | Promote one or more nodes to manager in the swarm |
docker node ps | List tasks running on one or more nodes, defaults to current node |
docker node rm | Remove one or more nodes from the swarm |
docker node update | Update a node |