Open Smithx10 opened 7 years ago
After reading through ./lib/backends/sdc/affinity.js, I think we are only checking what is currently running and handing it off to DAPI. This explains why when submitted at the same time the services are landing on the same computenode.
Hey, you likely want:
com.docker.swarm.affinities=["com.example.type!=jenkins-consul*"]
In your example you are trying to match "jenkins-consul" exactly.
Check out https://apidocs.joyent.com/docker/features/placement
Edit: Didn't notice this was a label filter and not container. Let me gather some more data.
Filed internally as https://smartos.org/bugview/DOCKER-1039
I've discovered if you create an affinity rule and run
docker-compose scale consul=3
all 3 instances start on the same node.If I run
docker-compose scale consul=1 && docker-compose scale consul=2 && docker-compose scale consul=3
they honor the affinity rules.Docker-Compose.yml: