Does traefik know docker-compose service names?

How exactly does Traefik talk to docker services when they're defined in a docker-compose file? For example, if you have two identical docker-compose files - except they have separate external networks - then is there any way Traefik could get confused about which is which? In my testing it does seem like it... Perhaps each docker-compose file needs to have unique service names, despite each service getting unique IPs in docker's networking - and also despite each docker-compose project being isolated via COMPOSE_PROJECT_NAME variable.

@ldez Hoping you know the answer to this :slight_smile:

Found someone with a similar issue, but my config is just like theirs and they are not getting this error (detailed below):

Figured it out! I had - "traefik.docker.network:${NETWORK}"
instead of
- "traefik.docker.network=${NETWORK}"
in a few places. Would be great if that syntax failed instead of being sent to traefik & misinterpreted.

Now I just need to figure out how to get traefik docker labels to work during docker-compose build time:

The following does not work:

    app:
      container_name: "app-${COMPOSE_PROJECT_NAME}"
      image: "app"
      restart: always
      build:
        context: .
        network: "${NETWORK}"
        args:
         - project=$COMPOSE_PROJECT_NAME
 #      labels:
 #        - "traefik.enable=true"
 #        - "traefik.port=3000"
 #        - "traefik.docker.network=${NETWORK}"

Those layers get built into the image and do not supply treafik with the information it needs.

So basically app needs to be taken offline before the build time networking will work now... Perhaps there is some networking for 'app' hanging around between builds. I tried giving it a different network (a build_time_network), but still traefik seems to grab it due to the fact that app is around running. This problem will get fixed when I start doing builds on a separate system, but it would be nice to be able to change traefik.docker.network during build: context vs the services label: context.