Need help to get the correct container name as subdomain

Hi there,
I'm quite new to docker and also to traefik2.

I deployed some containers with docker-compose:

services:
  traefik:
    container_name: traefik
    image: traefik:v2.0
    restart: always
    volumes:
      - ./traefik.toml:/etc/traefik/traefik.toml
      - /var/run/docker.sock:/var/run/docker.sock:ro
    labels:
      - "traefik.enable=true"
      - "traefik.http.middlewares.auth.basicauth.users=username:REDACTED"
      - "traefik.http.routers.traefik.middlewares=auth"
      - "traefik.http.routers.traefik.service=api@internal"
    ports:
      - "80:80"
      - "443:443"
    networks:
      - default
      - traefik

  whoami:
    image: "containous/whoami"
    container_name: "simple-service"
    labels:
      - "traefik.enable=true"
    networks:
      - traefik

networks:
  traefik:
    external: true

My traefik config looks like this:

[global]
  checkNewVersion = true
  sendAnonymousUsage = false

[entryPoints]
  [entryPoints.web]
    address = ":80"

[log]

[accessLog]

[api]
  dashboard = true
  insecure = false

[ping]

[providers.docker]
  defaultRule = "Host(`{{ normalize .Name }}.my.domain`)"
  exposedByDefault = false

I would expect that the Containers get rules like traefik.my.domain or whoami.my.domain, but they actually are traefik-root.my.domain or whoami-root.my.domain.

Does someone know how i can fix this without having to define the rule for every container?

Hello,

you use .Labels

[providers.docker]
 defaultRule = "Host(`{{ index .Labels \"com.docker.compose.project\" }}.my.domain`)"

Isn't that exactly the label I don't want?

~> docker inspect traefik |grep project
"com.docker.compose.project": "root",

so com.docker.compose.service