...

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

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

     1# node rm
     2
     3<!---MARKER_GEN_START-->
     4Remove one or more nodes from the swarm
     5
     6### Aliases
     7
     8`docker node rm`, `docker node remove`
     9
    10### Options
    11
    12| Name                                | Type | Default | Description                        |
    13|:------------------------------------|:-----|:--------|:-----------------------------------|
    14| [`-f`](#force), [`--force`](#force) |      |         | Force remove a node from the swarm |
    15
    16
    17<!---MARKER_GEN_END-->
    18
    19## Description
    20
    21Removes the specified nodes from a swarm.
    22
    23> **Note**
    24>
    25> This is a cluster management command, and must be executed on a swarm
    26> manager node. To learn about managers and workers, refer to the
    27> [Swarm mode section](https://docs.docker.com/engine/swarm/) in the
    28> documentation.
    29
    30## Examples
    31
    32### Remove a stopped node from the swarm
    33
    34```console
    35$ docker node rm swarm-node-02
    36
    37Node swarm-node-02 removed from swarm
    38```
    39
    40### Attempt to remove a running node from a swarm
    41
    42Removes the specified nodes from the swarm, but only if the nodes are in the
    43down state. If you attempt to remove an active node you will receive an error:
    44
    45```console
    46$ docker node rm swarm-node-03
    47
    48Error response from daemon: rpc error: code = 9 desc = node swarm-node-03 is not
    49down and can't be removed
    50```
    51
    52### <a name="force"></a> Forcibly remove an inaccessible node from a swarm (--force)
    53
    54If you lose access to a worker node or need to shut it down because it has been
    55compromised or is not behaving as expected, you can use the `--force` option.
    56This may cause transient errors or interruptions, depending on the type of task
    57being run on the node.
    58
    59```console
    60$ docker node rm --force swarm-node-03
    61
    62Node swarm-node-03 removed from swarm
    63```
    64
    65A manager node must be demoted to a worker node (using `docker node demote`)
    66before you can remove it from the swarm.
    67
    68## Related commands
    69
    70* [node demote](node_demote.md)
    71* [node inspect](node_inspect.md)
    72* [node ls](node_ls.md)
    73* [node promote](node_promote.md)
    74* [node ps](node_ps.md)
    75* [node update](node_update.md)

View as plain text