I am using docker version 1.12.4. Let me try to explain my problem;
Assume that you have 4 nodes in your cluster and 3 replicas of a service and lets assume this application provides kind of web API on a port. I mapped this port to hosting node’s 80 port on each node by publishing it. Now I can access my web api on all nodes, even from the node which does not have the service deployed in it. Docker swarm somehow handles it and handling the load balancing and this is really marvellous.
When I try to scale it down, there is something weird happened. Lets scale it down from 3 to 2. There is no problem at swarm manager node, but when I try to access the api via worker nodes, load balancing does not work properly. Some of my requests has no response, some of them has no problem. I guess worker nodes are directing me to a service which is not actually up and running because of the scaling down. This makes me think that, there may be a bug which is ; when you scale your services down, swarm manager does not inform the worker docker nodes about the containers which is shutdown because of the scaling down.
Is there anyone who is dealing with this problem? Or do I miss something?
I create the service like;
docker service create --name bird-enki --replicas=5 --env DYNACONF_SETTINGS=settings.test --mount type=bind,source=/etc/hosts,destination=/etc/hosts,readonly=true --publish 80:9000 my-registry:5000/bird-enki:0.2.3
and scale the service like;
docker service scale bird-enki=2