TCP (IMAP) Sticky/Persistent connections on Docker Swarm


I'm wondering if it's possible to have sticky sessions for TCP connections like IMAP on Docker Swarm.

When my IMAP client now connects and authenticates the connection goes to all contianers in my swam environment and not just one which let my IMAP client hang all the time.

With HA proxy I was able to manage this in the past to make connections persistent but I can't find a solution to manage this with Traefik.

Any ideas ?

Interesting, there seems to be a Traefik marketing blurb about sticky, which includes TCP (link). But in the dynamic config file reference there seems to be no sticky for TCP (doc).

Maybe open a feature request on Github.

That's exactly what I found out... I will create a feature request, but as I need it actually right now I might move (back) to Caddy again which has a perfect plugin support for anything.

What was the reason to come to Traefik?

We use it for the Docker Swarm Configuration Discovery, which seems to exist nowhere else.

Yes that was the same approach for me. But why do I want it when Caddy can actually do the same by putting a service name in and do proper L4 on TCP when I need that; and lots more.