Traefik not routing domains to correct containers - instead round robining


Allow me the explain the context. This issue relates to our local environment setup, for multiple projects. We have many projects, and often times we want to run them locally simultaneously to work on and test interactions between them. We manage all this using docker, and each project has it's own independent docker-compose file, with the services it requires.

In order to route domains to specific projects, we have used nginx-proxy container in the past (ran outside of docker-compose, since it only needs to be ran once), which forwards requests. This worked fine, but at some point (possibly after upgrading to docker-compose v3 from v2), we started getting this weird issue, where every project started after the first, would get round-robinned to, instead of routed to correctly.

Allow be to demonstrate - let's say we have projects Butter with domain B and project Mushroom with domain M.

If we start B, then M (in terms of docker-compose up), this is what would happen:

B -> Butter 100% of the time
M -> Mushroom 50% of the time, Butter 50% of the time.

Not at all the desired routing pattern.

Since nginx-proxy container is no longer supported, and for other reasons, we decided to switch to traefik, but to our surprise, we have the exact same problem.

I am going to link to a gist with the docker-compose files of 2 projects, and then command used to start traefik. I removed a whole bunch of irrelevant stuff in the docker compose files since really we're only concerned with nginx and network config.

I can even see all the settings and domains coming up correctly in the traefik admin monitor, I just cannot explain why this behaviour is occurring.

If anyone has any idea of how to route domains to their respective projects correctly, that's be great. And again just to clarify what we want is...

Domain A > Project A
Domain B > Project B
Domain C > Project C

Each project having it's own docker-compose file, and being able to be ran independently.

Thanks, and happy new year !

It appears that you are using traefik v1 configuration for traefik v2. This is not going to work.

Oh really? Ok that makes sense.

What should the v2 equivalent be? How can I differentiate between v1 and v2 docs on ?

On the left column of this site the bottom item is the version selector. To elaborate frontend and backend are v1 concepts they no longer exist in v2.

Thanks @zespri - after reading the docs I managed to reconfigure it and it works now!