AdGuard Home with DoH/DoT
Privacy-focused ad blocking with AdGuard Home, DNS-over-HTTPS, and DNS-over-TLS support.
Overview
AdGuard Home is a network-wide DNS sinkhole that blocks advertisements and trackers at the DNS level, developed by AdGuard as an open-source alternative to commercial DNS filtering services. Unlike browser-based ad blockers, AdGuard Home protects all devices on your network by intercepting DNS queries before they reach advertising servers, while supporting modern encrypted DNS protocols including DNS-over-HTTPS (DoH), DNS-over-TLS (DoT), and DNS-over-QUIC.
This stack combines AdGuard Home with Prometheus and Grafana to create a comprehensive privacy-focused DNS infrastructure with advanced monitoring capabilities. Prometheus scrapes metrics from AdGuard Home's built-in statistics API, while Grafana visualizes query patterns, blocking rates, and client behavior through customizable dashboards. The configuration enables both traditional DNS (port 53) and encrypted DNS protocols (ports 443 and 853) to protect against DNS eavesdropping and manipulation.
This setup is ideal for privacy-conscious homelab enthusiasts, small businesses wanting to protect their networks from tracking, and IT administrators who need detailed insights into DNS traffic patterns. The combination of ad blocking, encrypted DNS, and comprehensive monitoring makes this stack particularly valuable for environments where both privacy and visibility are critical requirements.
Key Features
- DNS-over-HTTPS (DoH) and DNS-over-TLS (DoT) support for encrypted DNS queries
- Network-wide ad and tracker blocking using customizable filter lists
- Built-in DHCP server for automatic DNS configuration across network devices
- Parental controls with safe search enforcement and content filtering
- Real-time DNS query logging with client identification and response time tracking
- Prometheus metrics integration for advanced analytics and alerting
- Grafana dashboards for visualizing DNS traffic patterns and blocking statistics
- Custom DNS rewrites and upstream DNS server configuration with load balancing
Common Use Cases
- 1Homelab DNS infrastructure with privacy protection and comprehensive monitoring
- 2Small office networks requiring centralized ad blocking and content filtering
- 3IoT device networks where individual ad blocking installation is impossible
- 4Privacy-focused households wanting to prevent DNS tracking and profiling
- 5Educational environments needing parental controls and safe browsing enforcement
- 6Network administrators requiring detailed DNS analytics and threat intelligence
- 7Remote work setups where secure DNS resolution protects against malicious domains
Prerequisites
- Docker host with at least 512MB RAM available for the complete stack
- Network administrator access to configure router DNS settings or DHCP
- SSL certificates for DoH/DoT functionality (can be self-signed for internal use)
- Understanding of DNS concepts and network routing for proper upstream configuration
- Port 53 availability on Docker host (may conflict with systemd-resolved)
- Basic knowledge of Prometheus metrics and Grafana dashboard configuration
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 adguardhome: 3 image: adguard/adguardhome:latest4 ports: 5 - "53:53/tcp"6 - "53:53/udp"7 - "67:67/udp"8 - "853:853/tcp"9 - "3000:3000/tcp"10 - "443:443/tcp"11 - "443:443/udp"12 volumes: 13 - adguard_work:/opt/adguardhome/work14 - adguard_conf:/opt/adguardhome/conf15 - ./certs:/opt/adguardhome/certs:ro16 networks: 17 - adguard-net18 restart: unless-stopped1920 prometheus: 21 image: prom/prometheus:latest22 ports: 23 - "9090:9090"24 volumes: 25 - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro26 - prometheus_data:/prometheus27 networks: 28 - adguard-net29 restart: unless-stopped3031 grafana: 32 image: grafana/grafana:latest33 ports: 34 - "3001:3000"35 environment: 36 GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}37 volumes: 38 - grafana_data:/var/lib/grafana39 depends_on: 40 - prometheus41 networks: 42 - adguard-net43 restart: unless-stopped4445volumes: 46 adguard_work: 47 adguard_conf: 48 prometheus_data: 49 grafana_data: 5051networks: 52 adguard-net: 53 driver: bridge.env Template
.env
1# Grafana2GRAFANA_PASSWORD=secure_grafana_password34# AdGuard Home default credentials5# Username: admin6# Password: Set during initial setupUsage Notes
- 1Initial setup at http://localhost:3000
- 2Supports DoH (port 443) and DoT (port 853)
- 3Configure upstream DNS servers in settings
- 4Enable DHCP server for automatic DNS configuration
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
adguardhome
adguardhome:
image: adguard/adguardhome:latest
ports:
- 53:53/tcp
- 53:53/udp
- 67:67/udp
- 853:853/tcp
- 3000:3000/tcp
- 443:443/tcp
- 443:443/udp
volumes:
- adguard_work:/opt/adguardhome/work
- adguard_conf:/opt/adguardhome/conf
- ./certs:/opt/adguardhome/certs:ro
networks:
- adguard-net
restart: unless-stopped
prometheus
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
networks:
- adguard-net
restart: unless-stopped
grafana
grafana:
image: grafana/grafana:latest
ports:
- "3001:3000"
environment:
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}
volumes:
- grafana_data:/var/lib/grafana
depends_on:
- prometheus
networks:
- adguard-net
restart: unless-stopped
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 adguardhome:5 image: adguard/adguardhome:latest6 ports:7 - "53:53/tcp"8 - "53:53/udp"9 - "67:67/udp"10 - "853:853/tcp"11 - "3000:3000/tcp"12 - "443:443/tcp"13 - "443:443/udp"14 volumes:15 - adguard_work:/opt/adguardhome/work16 - adguard_conf:/opt/adguardhome/conf17 - ./certs:/opt/adguardhome/certs:ro18 networks:19 - adguard-net20 restart: unless-stopped2122 prometheus:23 image: prom/prometheus:latest24 ports:25 - "9090:9090"26 volumes:27 - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro28 - prometheus_data:/prometheus29 networks:30 - adguard-net31 restart: unless-stopped3233 grafana:34 image: grafana/grafana:latest35 ports:36 - "3001:3000"37 environment:38 GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}39 volumes:40 - grafana_data:/var/lib/grafana41 depends_on:42 - prometheus43 networks:44 - adguard-net45 restart: unless-stopped4647volumes:48 adguard_work:49 adguard_conf:50 prometheus_data:51 grafana_data:5253networks:54 adguard-net:55 driver: bridge56EOF5758# 2. Create the .env file59cat > .env << 'EOF'60# Grafana61GRAFANA_PASSWORD=secure_grafana_password6263# AdGuard Home default credentials64# Username: admin65# Password: Set during initial setup66EOF6768# 3. Start the services69docker compose up -d7071# 4. View logs72docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/adguard-home-stack/run | bashTroubleshooting
- AdGuard Home web interface shows 'bind: address already in use': Stop systemd-resolved with 'sudo systemctl disable systemd-resolved' and configure alternative DNS resolution
- DoH/DoT not working with certificate errors: Ensure SSL certificates in ./certs directory match your domain name and have proper file permissions (644)
- Grafana shows 'no data points' for AdGuard metrics: Verify prometheus.yml includes AdGuard Home target at 'adguardhome:3000/control/stats' endpoint
- DNS queries not being blocked on client devices: Check that devices are configured to use the Docker host IP as their DNS server
- High memory usage by Prometheus: Reduce metrics retention time in prometheus.yml or limit the query log retention in AdGuard Home settings
- AdGuard Home loses configuration after restart: Ensure adguard_conf volume is properly mounted and has write permissions for container user
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
adguard-homenginxprometheusgrafana
Tags
#dns#ad-blocking#adguard#doh#dot#privacy
Category
Home Lab & Self-HostingAd Space
Shortcuts: C CopyF FavoriteD Download