Traefik not honoring


I'm running Traefik v2.0.2 and I've run into what feels like a bug, but I want to make sure I'm not screwing something simple up.

I have several containers that need to talk to a database, and I want traefik in front of them. I've set them up with multiple networks like this :

version: '3.6'
    image: drupal:7
    container_name: www-example-com
    restart: always
      - /srv/drupal7/all:/var/www/html/sites/all
      - /srv/drupal7/
    labels: "web"
      traefik.enable: true 80 "http"

      traefik.http.routers.www-example-com.entrypoints: "http,https"
      traefik.http.routers.www-example-com.rule: "Host(``,``)"

      traefik.http.routers.www-example-com-https.entrypoints: "http,https"
      traefik.http.routers.www-example-com-https.rule: "Host(``,``)"
      traefik.http.routers.www-example-com-https.service: "www-example-com-https"
      traefik.http.routers.www-example-com-https.tls.certresolver: "letsEncrypt"
          - www-example-com
    internal: true

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 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?

Sure. Here's the docker compose file :

version: '3.6'
    image: traefik:latest
    container_name: traefik
    restart: always
      - /srv/traefik/traefik.toml:/traefik.toml:Z
      - /srv/traefik/servers.toml:/servers.toml:Z
      - /srv/traefik/acme.json:/acme.json:Z
      - /var/run/docker.sock:/var/run/docker.sock
      - target: 80
        published: 80
        protocol: tcp
        mode: host
      - target: 443
        published: 443
        protocol: tcp
        mode: host
      - target: 8443
        published: 8443
        protocol: tcp
        mode: host
      - web
      - bridge

    driver: bridge

Next up, the traefik.toml :

  checkNewVersion = true
  sendAnonymousUsage = false

  #level = "DEBUG"


  insecureSkipVerify = true

    address = ":80"

    address = ":443"

    address = ":8080"

    address = ":8443"

  endpoint = "unix:///var/run/docker.sock"
  exposedByDefault = false
  defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)"
  watch = true

  filename = "servers.toml"

  dashboard = true
  #insecure = true

  entryPoint = "health"

  email = ""
  storage = "acme.json"
    entryPoint = "http"

And finally servers.toml :

    entryPoints = ["traefik"]

    entryPoints = ["traefik"]
    rule="PathPrefix(`/api`) || PathPrefix(`/dashboard`)"


      X-Clacks-Overhead = "GNU Terry Pratchett"

    scheme = "https"
    port = "443"
    permanent = true

    users = [


@dduportal Any thoughts on this?

1 Like

Sorry, Did not had time (yet) to work on this case? I'll let you know :slight_smile:

1 Like

when use multiple networks, maybe traefik get wrong ip

update at 2019-11-07 19:05:56

solved provides a default to use for all containers, it's overridden by In my situation, I'm defining and it's still getting the wrong IP.

1 Like

Are there any clues in the debug log?

my overlay-network-internal is external network. but your network is created by docker-compsoe.

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 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 _.

In order to have a consistent and deterministic name, I used to specify the flag -p for the docker-compose (or set the environment variable $COMPOSE_PROJECT_NAME). More on this:

1 Like

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 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