简体   繁体   中英

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. We have three containers and wanted to run 3 docker-engine hosts. When I initially brought them up with a replica of 2 one of the services ended up running both containers on the same node.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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