Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove node from swarm?

I added three nodes to a swarm cluster with static file mode. I want to remove host1 from the cluster. But I don't find a docker swarm remove command:

Usage: swarm [OPTIONS] COMMAND [arg...]
Commands:
  create, c Create a cluster
  list, l   List nodes in a cluster
  manage, m Manage a docker cluster
  join, j   join a docker cluster
  help, h   Shows a list of commands or help for one command

How can I remove the node from the swarm?

like image 993
firelyu Avatar asked Jan 20 '16 10:01

firelyu


People also ask

How do you remove a node from a docker Swarm?

To remove the node from the swarm, run docker node rm <NODE> . Re-join the node to the swarm with a fresh state using docker swarm join .

What is a swarm node?

A node is an instance of the Docker engine participating in the swarm. You can also think of this as a Docker node. You can run one or more nodes on a single physical computer or cloud server, but production swarm deployments typically include Docker nodes distributed across multiple physical and cloud machines.


2 Answers

Using Docker Version: 1.12.0, docker help offers:

➜  docker help swarm

Usage:  docker swarm COMMAND

Manage Docker Swarm

Options:
      --help   Print usage

Commands:
  init        Initialize a swarm
  join        Join a swarm as a node and/or manager
  join-token  Manage join tokens
  update      Update the swarm
  leave       Leave a swarm

Run 'docker swarm COMMAND --help' for more information on a command.

So, next try:

➜  docker swarm leave --help

Usage:  docker swarm leave [OPTIONS]

Leave a swarm

Options:
      --force   Force leave ignoring warnings.
      --help    Print usage
like image 112
arcseldon Avatar answered Sep 28 '22 04:09

arcseldon


Using the swarm mode introduced in the docker engine version 1.12, you can directly do docker swarm leave.

like image 41
Toni Piza Avatar answered Sep 28 '22 06:09

Toni Piza