There's nothing special in my traefik config, and if I remove the database network from the above config, things work as you would expect, though of course I can't get to the database. When I add in the database network, however, traefik starts having some problems. Occasionally it will work fine, and other times I get a gateway timeout. When I'm getting a gateway timeout, I can look at the traefik dashboard and see that the www-example-com-https service has an IP address in the database network, which traefik doesn't have access to.
Is this a known issue? Or have I somehow configured something wrong? My understanding is that the traefik.docker.network label identifies the network traefik should use to communicate with the container. Is that not correct?
Hi @XenoPhage, thanks for your interest. As it is hard to analyze the problem with partial information, can you share the whole setup (including Traefik configuration AND compose definition) please?
providers.docker.network provides a default to use for all containers, it's overridden by traefik.docker.network. In my situation, I'm defining traefik.docker.network and it's still getting the wrong IP.
Hi @XenoPhage, I was able to reproduce the behavior and locate the error.
What @minbaby said is true, the "warning" screenshot from the documentation should tip you: you have to change the value of traefik.docker.network to the real name of the network, not the reference name from within the docker-compose.yml alas. I was able to make your setup work by retrieving the name with the command docker network ls.
This is a limitation from docker-compose, whom "namespace" the networks by prefixing their names with <project name of the stack> and an underscore _.
Why does it matter if it is an external network or an external network created by a docker-compose file (traefik's docker-compose)? I'm having a similar issue where treafik.docker.network isn't working, but I get the error:
error msg="Skip container service-COMPOSE_PROJECT_NAME_evaluated: field not found, node: network:{NETWORK}" providerName=docker