简体   繁体   English

Docker Swarm模式服务反关联性

[英]Docker Swarm Mode service anti-affinity

We are experimenting with docker v1.12 swarm mode using docker service and trying to find a way to ensure containers do not run on the same node. 我们正在试验使用docker服务的docker v1.12群模式,并试图找到一种确保容器不在同一节点上运行的方法。 We have three containers and wanted to run 3 docker-engine hosts. 我们有三个容器,想要运行3个docker-engine主机。 When I initially brought them up with a replica of 2 one of the services ended up running both containers on the same node. 当我最初使用2的副本启动它们时,其中一个服务最终在同一节点上运行了两个容器。

For now I'm getting around this by making them global but I was hoping to find a way to do this. 目前,我正在通过使其全球化来解决这个问题,但我希望找到一种方法来做到这一点。 I've seen that you can use labels and then create multiple services for the same container and use constraints but was wondering if there is an easier way. 我已经看到您可以使用标签,然后为同一个容器创建多个服务并使用约束,但是想知道是否有更简单的方法。

You can use node labels on nodes and service constraints to influence task scheduling to some extent. 您可以在节点上使用节点标签服务约束来在一定程度上影响任务调度。 But for now swarm mode's scheduler capabilities are limited. 但是目前,群集模式的调度程序功能有限。

There is an open issue regarding your question without a solution: https://github.com/docker/docker/issues/26259 关于您的问题,有一个未解决的公开问题: https : //github.com/docker/docker/issues/26259

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM