So I have Pi-hole and Traefik both configured in Docker running as individual containers, Pi-hole pointing home.lab
to my local IP 192.168.1.199. I'm using it as my domain name in the rule.Host label for services that go through Traefik's network.
compose.yml for traefik:
services:
traefik:
container_name: traefik
image: traefik:v3.3
command:
- --log.level=DEBUG
- --api.insecure=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entryPoints.web.address=:80
- --entryPoints.secureweb.address=:443
ports:
- 80:80
- 443:443
- 8088:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
compose.yml for pihole:
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
networks:
- traefik_default
labels:
- "traefik.enable=true"
- "traefik.http.routers.pihole.entrypoints=web"
- "traefik.http.routers.pihole.rule=Host(`pihole.home.lab`)"
- "traefik.http.services.pihole.loadbalancer.server.port=80"
environment:
TZ: 'Asia/Calcutta'
FTLCONF_webserver_api_password: 'admin@pihole'
FTLCONF_dns_listeningMode: 'all'
volumes:
- './etc-pihole:/etc/pihole'
restart: unless-stopped
networks:
traefik_default:
external: true
I concluded that domain name resolution is the problem because I can access the service if the rule=Host(pihole.localhost
)