Pi-hole intercepts DNS queries from every device on your network and blocks requests to ad-serving and tracking domains. Your TV, phone, laptop and smart speaker all benefit without any app installs.
version: "3"
services:
pihole:
image: pihole/pihole:latest
container_name: pihole
ports:
- "53:53/tcp"
- "53:53/udp"
- "80:80/tcp"
environment:
TZ: 'Europe/London'
WEBPASSWORD: 'changeme'
volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
restart: unless-stopped
Run docker compose up -d. Access the admin panel at http://your-server-ip/admin.
Log into your router. Find the DHCP settings and set the Primary DNS to your Pi-hole's IP address. Leave Secondary DNS blank — if you set Google as a fallback, blocked domains will resolve through Google when Pi-hole is unreachable.
In Pi-hole, go to Adlists and add these URLs:
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://big.oisd.nl
https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/multi.txt
After adding, run Tools > Update Gravity to pull the lists. The combined count lands around 1.5–2 million blocked domains.
Some services break when Pi-hole blocks their telemetry endpoints. Common things to whitelist:
s.youtube.com — YouTube history tracking; blocks break certain video featuresclients1.google.com — Chrome update checks*amazon.com patterns — shopping cart features on some pagesPi-hole logs every query, so blocked services are easy to identify: check the query log, find the blocked domain, whitelist if needed.
Under Settings > DNS, choose your upstream resolver. Options:
I run Unbound in a second Docker container alongside Pi-hole and point Pi-hole at it.
A Raspberry Pi 4 2GB runs Pi-hole and handles a household DNS load with CPU to spare. Give it a static IP and a UPS so DNS stays up when the power flickers.
As an Amazon Associate, IT Lad earns from qualifying purchases made through links on this page. Read the full affiliate disclosure.