限制 swarm 为每个节点创建超过 X 个容器

Sha*_*gun 4 docker docker-swarm docker-machine

是否有任何限制 swarm 为每个工人创建例如 20 个容器。因此,为了更好的 QoS(服务质量),一名工作人员不会拥有超过 20 个容器,这也将防止过度使用主机资源?

谢谢

kev*_*kev 6

For docker-ce 19.03+, you can simply create/update your service with the --replicas-max-per-node option:

# create service with replicas-max-per-node=10
docker service create --replicas=100 --replicas-max-per-node=10 --name your_service_name your_image_name

# update service with replicas-max-per-node=20
docker service update --replicas-max-per-node=20 your_service_name
Run Code Online (Sandbox Code Playgroud)

read more

UPDATE (2020-04-10)

- Add 3.8 compose version
    Limit service scale to the size specified by the field deploy.placement.max_replicas_per_node
Run Code Online (Sandbox Code Playgroud)

read more


Mat*_*ron 2

编辑

该功能现已实现,并将作为 Docker 19.03 的一部分发布。

您可以在 docker/cli#1410 上看到它如何与堆栈一起工作,以及在 docker/cli#1612 上看到没有堆栈(docker 服务...)时如何工作

来源


其实没有。

有一个Github 问题正在讨论它。

  • 更新:看起来这已经实现了,并且应该在 Docker CE 19.03 发布时作为“max-replicas-per-node”提供。 (4认同)