Cloudflared (DoH) in Docker: setup, health-check e integrazione con Pi-hole/OpenWrt
DNS over HTTPS solido con health-check e metriche, collegabile a Pi-hole o direttamente al router.
Docker Compose
mkdir -p /opt/dns && cd /opt/dns
cat > docker-compose.yml <<'YML'
version: "3.8"
services:
cloudflared:
image: cloudflare/cloudflared:latest
command: proxy-dns --port 5053 \
--upstream https://1.1.1.1/dns-query \
--upstream https://1.0.0.1/dns-query \
--metrics 0.0.0.0:8080
ports:
- "5053:5053/udp"
- "5053:5053/tcp"
- "8080:8080/tcp"
restart: unless-stopped
healthcheck:
test: ["CMD","wget","-qO-","http://127.0.0.1:8080/metrics"]
interval: 30s
timeout: 5s
retries: 3
YML
docker compose up -d
Test
dig @127.0.0.1 -p 5053 example.com +short
curl -s http://127.0.0.1:8080/metrics | head
Pi-hole → DNS: 127.0.0.1#5053
. OpenWrt → dnsmasq server: 127.0.0.1#5053
.
Vedi anche: Pi-hole · Unbound ricorsivo