Who substitutes what
Compose substitutes ${…} from .env into the compose file: labels, environment:, command:. Files the
service reads on its own are left alone — traefik.yml reaches the container as is.
So traefik.yml gets explicit values:
certificatesResolvers:
cloudflare:
acme:
email: [email protected] # not ${EMAIL_FOR_SSL}
Pass what you’d like to take from .env as the container’s environment variables — that’s how Traefik gets the
DNS provider token: CF_DNS_API_TOKEN_FILE: /run/secrets/cf_api_token (Secrets in Docker stacks). Or move the static config entirely
into command: arguments — compose substitutes ${…} there. But Traefik won’t read a file and arguments together:
it has a single source of static config. Once it finds traefik.yml, it silently skips the command: arguments except --configFile.
What happens when the ACME email becomes the string ${…}, and how to change it — Traefik and Let’s Encrypt.