Comments on: How to maintain Session Persistence (Sticky Session) in Docker Swarm http://littlebigextra.com/how-to-maintain-session-persistence-sticky-session-in-docker-swarm-with-multiple-containers/ A technology blog covering topics on Java, Scala, Docker, AWS, BigData, DevOps and much more to come. Do it yourself instructions for complex to simple problems for a novice to an expert. Wed, 27 Feb 2019 10:27:28 +0000 hourly 1 https://wordpress.org/?v=5.6.8 By: Shyam http://littlebigextra.com/how-to-maintain-session-persistence-sticky-session-in-docker-swarm-with-multiple-containers/#comment-1032 Wed, 27 Feb 2019 10:27:28 +0000 http://littlebigextra.com/?p=1016#comment-1032 Hi Abhi,

I am trying to implement loadbalaner. Your example worked for me.

But I am facing issues after adding my service to the compose file. My application runs on HTTPS and custom port. Could you please guide me in setting up the configurations for allowing traefik to process HTTPS requests.

Thanks,

Shyam

]]>
By: Abhishek Galoda http://littlebigextra.com/how-to-maintain-session-persistence-sticky-session-in-docker-swarm-with-multiple-containers/#comment-737 Wed, 03 Oct 2018 15:11:54 +0000 http://littlebigextra.com/?p=1016#comment-737 Agree but this was one of the option at hand nothing else worked!

]]>
By: Abhi http://littlebigextra.com/how-to-maintain-session-persistence-sticky-session-in-docker-swarm-with-multiple-containers/#comment-734 Mon, 01 Oct 2018 14:43:35 +0000 http://littlebigextra.com/?p=1016#comment-734 Thanks for updating that !!

]]>
By: M Acharya http://littlebigextra.com/how-to-maintain-session-persistence-sticky-session-in-docker-swarm-with-multiple-containers/#comment-731 Sat, 29 Sep 2018 10:30:05 +0000 http://littlebigextra.com/?p=1016#comment-731 Parameter “traefik.backend.loadbalancer.sticky” has been deprecated, it should be “traefik.backend.loadbalancer.stickiness”

]]>
By: JustMe http://littlebigextra.com/how-to-maintain-session-persistence-sticky-session-in-docker-swarm-with-multiple-containers/#comment-696 Thu, 23 Aug 2018 10:47:00 +0000 http://littlebigextra.com/?p=1016#comment-696 If you do this:
– /var/run/docker.sock:/var/run/docker.sock
you are pretty much granting ROOT access to the underlying HOST machine to any user on your container. In general, this (hopefully obviously) is a really bad idea.

]]>
By: Kavin http://littlebigextra.com/how-to-maintain-session-persistence-sticky-session-in-docker-swarm-with-multiple-containers/#comment-136 Sat, 04 Nov 2023 23:46:25 +0000 http://littlebigextra.com/?p=1016#comment-136 Hi Abhi, I am trying to implement load balancing while maintain session stickyness for docker containers deployed in a swarm. I am unable to reach specific containers when I search for : for my case it is 10.244.102.243/TestManager

Heres my docker-compose file :
version: ‘3’
services:
test_manager:
image: 10.244.102.10:5000/testmanager
networks:
– net
deploy:
mode: replicated
replicas: 3
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
labels:
– “traefik.docker.network=autoframework_net”
– “traefik.port=80”
– “traefik.frontend.rule=Host:10.244.102.243; PathPrefix:/TestManager”
– “traefik.backend.loadbalancer.sticky=true”
ports:
– “8080”

loadbalancer:
image: traefik
command: –docker \
–docker.swarmmode \
–docker.watch \
–web \
–loglevel=DEBUG
ports:
– 80:80
– 9090:8080
volumes:
– /var/run/docker.sock:/var/run/docker.sock
deploy:
restart_policy:
condition: any
mode: replicated
replicas: 1
update_config:
delay: 2s
placement:
constraints: [node.role == manager]
networks:
– net

networks:
net:

]]>
By: Kevin http://littlebigextra.com/how-to-maintain-session-persistence-sticky-session-in-docker-swarm-with-multiple-containers/#comment-78 Thu, 03 Aug 2023 12:12:01 +0000 http://littlebigextra.com/?p=1016#comment-78 That worked! Removing the priority labels and the whoami service, GOGS works fine!

So seems like there is some issue with Traefik and multiple services + priority labels…

]]>
By: Abhi http://littlebigextra.com/how-to-maintain-session-persistence-sticky-session-in-docker-swarm-with-multiple-containers/#comment-77 Thu, 03 Aug 2023 11:16:14 +0000 http://littlebigextra.com/?p=1016#comment-77 True doesnt make any sense, did you tried removing priority from labels from gogs and taking down whoami service.

]]>
By: Kevin http://littlebigextra.com/how-to-maintain-session-persistence-sticky-session-in-docker-swarm-with-multiple-containers/#comment-76 Thu, 03 Aug 2023 11:11:32 +0000 http://littlebigextra.com/?p=1016#comment-76 Yeah, maybe.

But why does GOGS stop working if I remove the whoami service? That doesn’t make any sense for me…

]]>
By: Abhi http://littlebigextra.com/how-to-maintain-session-persistence-sticky-session-in-docker-swarm-with-multiple-containers/#comment-75 Thu, 03 Aug 2023 10:22:08 +0000 http://littlebigextra.com/?p=1016#comment-75 Hi,
Glad that your GOGs service is working fine with session persistence. The reason it won’t work with WHOAMI service is probably that trafeik uses a cookie called “traefik_backend” to store the container IP. I think in the case of 2 services using “sticky=true” it overrides the proxy value with the new container.
May be trafeik team needs to consider this scenario and may be writing multiple cookies if sticky=true for multiple services.

]]>