I am currently trying to instantiate a Redis container separately on each cluster machine using Docker Swarm / Compose. I am currently using 4 cars. Using binding labels, the idea was to make sure that two instances of redis would not be assigned to the same computer.
At first it worked.
redis:
image: redis
environment:
AFFINITY: com.myself.name!=redis
labels:
- "com.myself.name=redis"
However, after some containers stopped simulating failures, pushing them back, disconnecting all containers, and then finally everyone starts from the very beginning with help docker-compose scale redis=4, I find redis, I launch two containers on the same machine, although there are 4 available in the cluster.
What exactly am I doing wrong? Thanks.