github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/docs/reference/commandline/node_rm.md (about)

     1  # node rm
     2  
     3  <!---MARKER_GEN_START-->
     4  Remove 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  
    21  Removes 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  
    37  Node swarm-node-02 removed from swarm
    38  ```
    39  
    40  ### Attempt to remove a running node from a swarm
    41  
    42  Removes the specified nodes from the swarm, but only if the nodes are in the
    43  down 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  
    48  Error response from daemon: rpc error: code = 9 desc = node swarm-node-03 is not
    49  down and can't be removed
    50  ```
    51  
    52  ### <a name="force"></a> Forcibly remove an inaccessible node from a swarm (--force)
    53  
    54  If you lose access to a worker node or need to shut it down because it has been
    55  compromised or is not behaving as expected, you can use the `--force` option.
    56  This may cause transient errors or interruptions, depending on the type of task
    57  being run on the node.
    58  
    59  ```console
    60  $ docker node rm --force swarm-node-03
    61  
    62  Node swarm-node-03 removed from swarm
    63  ```
    64  
    65  A manager node must be demoted to a worker node (using `docker node demote`)
    66  before 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)