8

我将三个节点添加到具有静态文件模式的 swarm 集群中。我想从集群中删除host1 。但我没有找到docker swarm remove命令:

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

如何从 swarm 中删除节点?

4

3 回答 3

3

使用 Docker 版本:1.12.0,docker help提供:

➜  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.

所以,下一次尝试:

➜  docker swarm leave --help

Usage:  docker swarm leave [OPTIONS]

Leave a swarm

Options:
      --force   Force leave ignoring warnings.
      --help    Print usage
于 2016-08-14T12:51:44.937 回答
1

使用 docker 引擎 1.12 版本中引入的 swarm 模式,可以直接做docker swarm leave.

于 2016-08-04T14:18:43.923 回答
0

“静态文件模式”的引用暗示了基于容器的独立 swarm,它早于当前的 Swarm 模式(大多数人称为 Swarm)。这是来自 Docker 的两个完全不同的“Swarm”产品,并且使用完全不同的方法进行管理。

这里的其他答案集中在 Swarm Mode 上。在目标节点上使用 Swarm Modedocker swarm leave将导致节点离开 swarm。当引擎不再与管理器对话时,docker node rm特定节点的活动管理器将清除集群内的任何延迟引用。

使用基于容器的经典 swarm,您将使用更新的静态列表重新创建管理器容器。如果您发现自己经常这样做,那么用于发现的外部数据库会更有意义(例如 consul、etcd 或 zookeeper)。鉴于经典的 swarm 已弃用且不再维护,我建议在任何新项目中使用 Swarm 模式或 Kubernetes。

于 2020-07-21T16:25:07.877 回答