Locating functional Docker Compose service configurations for the Traefik reverse proxy can be a challenging quest, especially ones that encompass a fully operational Traefik dashboard, seamless integration with Let's Encrypt, and robust IPv6 support. The ever-evolving landscape of Traefik, coupled with configuration variations across different versions, further complicates this pursuit. Fear not! Below unfolds a comprehensive example tailored for the latest Traefik version available at the time of this writing.
This Docker Compose service configuration features:
- Forcefully nudges insecure requests towards the safer realms of HTTPS.
- Elevates the Traefik dashboard to its majestic throne, guarded by the impenetrable shield of basic authentication (credentials: traefik/traefik).
- Harnesses the power of the Let's Encrypt ACME TLS challenge to effortlessly summon certificates for your esteemed domains.
- Optionally embraces the futuristic realm of IPv6 support, allowing your Docker Compose service configuration to seamlessly communicate over the latest generation of Internet Protocol.
- Edit
.env
to set configuration details - Create the required
traefik
network - Start the container with
docker compose up -d
- Monitor for errors with
docker compose logs -f
- Open your FQDNs in the browser and observe Traefik issuing certificates using Let's Encrypt's TLS challenge mechanism (may take a few seconds!).
Don't forget to remove the Let's Encrypt staging configuration in compose.yml
once everything is ready!
Create a network bridge by following these steps:
- For IPv4-only setups, use the command:
docker network create traefik
and you're done here. - If you want Traefik to be reachable over IPv6 too, modify the Docker daemon configuration in
/etc/docker/daemon.json
(example provided for Debian Bookworm):
{
"ipv6": true,
"ip6tables": true,
"fixed-cidr-v6": "fd00:1::/64",
"experimental": true
}
- Restart the Docker daemon after making this configuration change.
- Once the Docker daemon is restarted, initiate the IPv6-capable network bridge with the command:
docker network create --ipv6 --subnet=fd00:2::/64 traefik