Ads are everywhere — your phone, your TV, your laptop, even your smart speaker. Installing an ad blocker on each device is a losing battle. Pi-hole takes a smarter approach: it blocks ads for your entire network from one central place, so every device is covered automatically.
This guide shows you how to self-host Pi-hole with Docker in about 15 minutes. If you don’t have a server yet, start with our homelab setup guide.
What is Pi-hole?
Pi-hole is a network-wide ad blocker. It works as your local DNS server — when a device tries to reach a known ad or tracking domain, Pi-hole simply refuses to resolve it. The ad never loads.
Because it works at the DNS level, it blocks ads in apps, not just browsers — including smart TV ads, mobile game ads, and trackers that browser extensions miss.
Why Pi-hole instead of a browser extension?
- Covers every device on your network, not just one browser.
- Blocks in-app ads that uBlock Origin can’t touch.
- Centralized — one config, one blocklist, for everything.
- Free and open source.
What you need
- A Raspberry Pi, mini PC, or even an old laptop running Docker.
- About 15 minutes.
Step 1: Create the Docker Compose file
Create a folder and add a docker-compose.yml:
services:
pihole:
image: pihole/pihole:latest
container_name: pihole
restart: always
ports:
- "53:53/tcp"
- "53:53/udp"
- "80:8080"
environment:
TZ: "Asia/Ho_Chi_Minh"
WEBPASSWORD: "your-admin-password"
volumes:
- ./etc-pihole:/etc/pihole
- ./etc-dnsmasq.d:/etc/dnsmasq.d
A few notes:
- Port
53is the DNS port — this is what makes Pi-hole work. - Port
80:8080maps the web admin UI. - Replace
your-admin-passwordwith a strong password.
Step 2: Start it
docker compose up -d
Open http://your-server-ip:8080/admin to reach the dashboard.
Step 3: Point your router at Pi-hole
This is the step most people miss. Pi-hole only works if your devices actually use it for DNS. The cleanest way: log into your router’s admin page and set the DNS server to your Pi-hole’s IP address.
Every device on your network will now send DNS queries through Pi-hole, and ads will start disappearing.
How to verify it’s working
Open the Pi-hole dashboard and watch the “Queries Blocked” counter climb. Or visit a site with ads — you’ll notice they’re simply gone. You can also run a DNS leak test to confirm your queries route through Pi-hole.
Managing blocklists and whitelists
Pi-hole ships with a solid default blocklist, but you can expand it:
- Adlists: add community-maintained blocklists to block more.
- Whitelist: if a site breaks, add it to the whitelist to unblock it.
The dashboard makes both a two-click operation.
Common mistakes to avoid
- Skipping the router DNS step. Pi-hole running but unused is the most common mistake.
- Blocking too aggressively — some blocklists break legitimate sites; whitelist generously.
- No fallback DNS — if Pi-hole goes down, your internet goes with it. Keep a backup DNS in mind.
FAQ
Does Pi-hole slow down my internet?
No — it actually speeds up page loads slightly, because ads and trackers never download.
Can I use Pi-hole with a VPN or Tailscale?
Yes, and that’s a great way to get ad blocking on your phone even when you’re away from home.
What if Pi-hole breaks a website?
Add the site to the whitelist in the dashboard. That’s normal maintenance, not a failure.
Advanced: regex blocking
Blocklists cover most ads, but sometimes you want a surgical rule. Pi-hole supports regex filters — for example, to block every subdomain of a tracking network:
(^|\.)doubleclick\.net$
Use regex sparingly. It’s easy to over-block and break legitimate sites, so start with the default list and add regex only when you have a specific annoyance to kill.
Pi-hole on the go
Pi-hole normally only protects devices on your home network. Want ad blocking on your phone when you’re out and about? Pair Pi-hole with Tailscale or a WireGuard VPN — your phone routes its DNS through Pi-hole even on mobile data, so you get the same clean browsing everywhere.
Pi-hole vs browser ad blockers
A browser extension like uBlock Origin only blocks ads inside that browser. Pi-hole blocks at the DNS level, so it covers your whole network — phones, smart TVs, IoT devices, and every app. The two aren’t competing; they complement each other. Use Pi-hole as the network-wide net, and keep a browser blocker for cosmetic filtering.
Monitoring and statistics
The Pi-hole dashboard shows exactly what’s being blocked in real time: total queries, the percentage blocked, and the top blocked domains. It’s surprisingly satisfying to watch, and it doubles as an early warning system — if a device on your network suddenly starts hammering a suspicious domain, you’ll see it immediately.
What you’ll notice after setup
The first thing you’ll notice is speed — pages load faster because ads and trackers never download in the first place. The second is coverage: that annoying ad in your favorite mobile game is gone, and so is the pre-roll ad on your smart TV. It works invisibly in the background, and you’ll only remember Pi-hole is there when you visit a site that’s suddenly clean.
One honest caveat: some sites detect ad blockers and ask you to disable them. That’s a cat-and-mouse game, but for the vast majority of everyday browsing, Pi-hole simply works — and it keeps working for every device you ever add to your network.
The bottom line
Pi-hole is the single highest-impact upgrade you can make to your home network — set-and-forget ad blocking for every device you own. Pair it with a self-hosted homelab and you’ll wonder why you didn’t do it years ago.