Docker Community Forums

Share and learn in the Docker community.

[Solved] Docker stack internal sticky load balancing

(Konnoska) #1

Hello, I have a docker stack consisting of some services let’s call them service_1 and service_2. Both services are using the same overlay network. Clients communicate to service_1 in which I achieved sticky load balancing using traefik (I need sticky load balancing cause clients communicate to the containers of service_1 using However containers of service_1 communicate to containers of service_2 also by, meaning that I must somehow achieve sticky load balancing for service_2 without publishing service_2 outside the overlay nework. I haven’t found a way to achieve sticky load balancing for the internal service_2 instead of the default round Robin that docker offers.

Any proposals?

Thanks in advance

(Eldeberde) #2

This will disable the internal load balancer, so if you find the way to refer to an ip instead to the service name it should work. Is not a real solution but maybe can help you

(Konnoska) #3

Thanks for your answer, i had already seen that part of the documentation but i didn’t knew how to configure the load balancer in order to consume the IP list. I finally worked around my problem by using dnsrr mode, along with a handmade loadbalancer that does on the fly dns queries and saves inside the session cookies a random service_2 container’s IP.

I know it is a patchy solution but i could not invest more time on this issue (and untill now it works fine too).