My boring Blog

Mauro Frigerio blog

Multiple domains for the same container with Traefik

23-07-2022 1 min read article

This example shows how you can configure several domains to access the same docker container by using Traefik. In this example I want to connect the domains and to the same docker container.

All necessary files are available on GitHub.


  1. Two domain names that both point to the Traefik instance (in this example I use and
  2. For both domains the SSL certificate is generated by Let’s Encrypt
  3. Traefik is already working (see basic example)


  1. Aggiungere o modificare il docker-compose dei container interessati
    image: containous/whoami
    container_name: whoami
      - 'traefik.enable=true'
      - "traefik.http.routers.whoami.rule=Host(``) || Host(``)"  # <== edit
      - 'traefik.http.routers.whoami.entrypoints=web-secure'
      - 'traefik.http.routers.whoami.tls=true'
      - "traefik.http.routers.whoami.tls.certresolver=certificato"
      - "[0].main=*"
      - "[1].main=*" # <== add
  1. Recreate the whoami container with the command
sudo docker-compose up -d whoami
  1. In the browser try to reach the site using both addresses

If you discover problems in this guide or in the configuration files, you can open an issue on GitHub. Thank you!