bodo@naumann.dev
These are my apu2 DNServers running pihole on docker with traefik 2.0, my docker-compose.yml evolved to this:
version: '3'
services:
#
traefik:
container_name: traefik
domainname: ${DOMAINNAME}
image: traefik
restart: unless-stopped
command: --api.insecure=true --providers.docker --providers.docker.exposedbydefault=false --entrypoints.web.address=:80 #--providers.docker.defaultRule="Host(`${DOMAINNAME}`)"
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- default
- discovery
dns:
- 192.168.1.254
pihole:
container_name: pihole
domainname: ${DOMAINNAME}
image: pihole/pihole:latest
dns:
- 127.0.0.1
- 192.168.1.254
ports:
- '0.0.0.0:53:53/tcp'
- '0.0.0.0:53:53/udp'
- '0.0.0.0:67:67/udp'
volumes:
- pihole:/etc/pihole/
- dnsmasq:/etc/dnsmasq.d/
environment:
VIRTUAL_HOST: ${DOMAINNAME}
TZ: ${TZ}
WEBPASSWORD: 'usergo'
DNS1: 192.168.1.254
DNS2: 'no'
DNSSEC: 'False'
DNS_BOGUS_PRIV: 'True'
CONDITIONAL_FORWARDING: 'True'
CONDITIONAL_FORWARDING_IP: 192.168.1.254
CONDITIONAL_FORWARDING_DOMAIN: 'home'
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.pihole.rule=Host(`${DOMAINNAME}`)"
- "traefik.http.routers.pihole.entrypoints=web"
- "traefik.http.services.pihole.loadbalancer.server.port=80"
networks:
discovery:
volumes:
pihole:
dnsmasq:
I am using an environment file in /etc/environment to keep the variables:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
PUID=1001
PGID=1001
TZ="Europe/Zurich"
USERDIR="/home/cloud"
DOMAINNAME="apu01.home"
I use 192.168.1.254 as main DNServer, it is my OPNsense router running Unbound DNS. The router manages local DNS resolution and forwards WAN DNS requests to the configured Servers. Also it manages local queries to the Domain that I am hosting.