Running a Pi-hole Docker stack paired with Unbound gives every device on your network ad, tracker, and telemetry blocking while eliminating third-party DNS providers from logging your browsing history. Instead of forwarding unblocked queries to Cloudflare, Google, or your ISP, Unbound queries authoritative root servers directly and validates cryptographic DNSSEC signatures locally – all inside roughly 70 MB of combined container memory.
amd64 & arm64)pihole/pihole:2026.11.0 (Core v6.6, FTL v6.9, Web v6.6.1, dnsmasq v2.93+42, SQLite v3.54.1), klutchell/unbound:1.26.2 (distroless NLnet Labs Unbound 1.26.2)homelab/pihole-v6-unboundKey Takeaways
- Critical security baseline: Pinning
pihole/pihole:2026.11.0deploys Core v6.6 and FTL v6.9, closing four High-severity advisories (CVSS 7.2–7.3) while removing legacysudoandCAP_IPC_LOCKdependencies. - Modern Unbound image:
klutchell/unbound:1.26.2(~6.7 MB distroless, multi-archamd64/arm64, non-root UID101:102) replaces abandonedmvance/unboundimages stuck on Unbound 1.21.1 from October 2024. - Pure Pi-hole v6 syntax: Legacy v5 environment variables such as
WEBPASSWORDandPIHOLE_DNS_no longer work; v6 uses declarativeFTLCONF_*variables and a single./etc-pihole:/etc/piholemount. - Zero-downtime bridge networking: Assigning Unbound a static IP (
172.30.53.53) on a dedicated172.30.53.0/24subnet prevents total LAN DNS blackouts during out-of-order container restarts. - Clean port separation: Disabling Ubuntu’s
systemd-resolvedstub listener frees port 53, while moving Pi-hole’s web dashboard to8080,8443savoids conflicts with reverse proxies on ports 80 and 443.
Why Pair Pi-hole v6 with Unbound Recursive DNS?
Pairing Pi-hole v6 with Unbound turns your home server into an independent validating recursive resolver that contacts authoritative DNS root servers directly instead of handing your entire domain log to a single upstream corporation. After Cloudflare removed the cloudflared proxy-dns feature in February 2026, local recursive DNS is the cleanest replacement for broken DoH sidecar guides.
Most older Docker guides still reference outdated containers with real security gaps. Released on November 11, 2026, pihole/pihole:2026.11.0 bundles Core v6.6, FTL v6.9, Web v6.6.1, embedded dnsmasq v2.93+42, and SQLite v3.54.1. That update fixes four High-severity advisories – command execution through unescaped files.gravity paths (GHSA-pj9m-9623-2g75 / GHSA-cq9w-mv93-mxh7, CVSS 7.2) plus three root symlink-following flaws across pihole -r, pihole -up, and pihole -d (GHSA-wp3p-45h3-2v82, GHSA-5w4v-f65m-323f, GHSA-jvg9-fm8x-2jqq, CVSS 7.3) – and strips out sudo and CAP_IPC_LOCK in favor of setpriv.
On the resolver side, avoid copying legacy stacks built around mvance/unbound. That repository has not pushed an image update since October 19, 2024, leaving it stranded on Unbound 1.21.1 in a ~92 MB amd64-only container (with its companion Raspberry Pi image limited to legacy 32-bit arm/v7). Switching to klutchell/unbound:1.26.2 cuts the compressed footprint to roughly 6.7 MB across native amd64 and arm64 hosts, runs Unbound non-root as UID/GID 101:102, ships NLnet Labs Unbound 1.26.2 with up-to-date root trust anchors (including KSK-2024 key 38696), and includes the built-in drill-hc binary for Docker healthchecks.
| DNS Architecture | Third-Party DNS Logging | Encrypted / Validated DNS (DNSSEC) | Container Footprint & Arch | Pi-hole v6 Env Var Support | Security Maintenance Status |
|---|---|---|---|---|---|
Pi-hole v6 + Unbound (klutchell/unbound:1.26.2) | None (queries authoritative root/TLD servers directly) | Full local DNSSEC validation + QNAME minimisation | ~6.7 MB distroless Unbound + Alpine Pi-hole (amd64/arm64) | Full native FTLCONF_* + pihole.toml | Active (Nov 2026 Pi-hole 2026.11.0 & Unbound 1.26.2) |
| Pi-hole v6 + Public Upstream (Cloudflare / Quad9) | Full query history visible to chosen provider | Upstream DNSSEC only; plaintext UDP/53 unless DoT/DoH proxy added | Single Alpine container (amd64/arm64) | Full native FTLCONF_* | Active (legacy cloudflared proxy-dns removed Feb 2026) |
| AdGuard Home (DoH / DoT) | Full query history visible to DoH/DoT provider | Native encrypted DoH/DoT/DoQ transport + upstream DNSSEC | Single Go binary container (amd64/arm64) | N/A (YAML config via AdGuardHome.yaml) | Active |
Legacy Pi-hole v5 + mvance/unbound | None (recursive resolution) | Outdated static root keys risk KSK-2024 failures | ~92 MB amd64-only Unbound (no modern arm64) | Broken (uses removed WEBPASSWORD / PIHOLE_DNS_) | Abandoned (mvance/unbound frozen Oct 2024 on 1.21.1) |
Step 1: Free Port 53 on Ubuntu and Debian Hosts
Ubuntu Server 24.04 binds systemd-resolved to 127.0.0.53:53 out of the box, which causes Docker to crash immediately with bind: address already in use when Pi-hole claims port 53. Adding a drop-in override setting DNSStubListener=no and repointing /etc/resolv.conf frees port 53 permanently while preserving normal host DNS lookups.
Before exposing DNS services on your home server, make sure your base OS firewall, SSH key authentication, and automatic security updates are already locked down – if you are starting from a fresh machine, walk through our Ubuntu Server security hardening guide first and ensure UFW only allows UDP/TCP port 53 from your private LAN subnet rather than the public internet. Next, confirm that systemd-resolved already knows a real upstream nameserver before turning off the local stub listener:
grep nameserver /run/systemd/resolve/resolv.conf
You should see at least one router or ISP IP address (for example, nameserver 192.168.1.1). Now create a persistent drop-in override file so future Ubuntu package upgrades never overwrite your change, symlink /etc/resolv.conf to the non-stub resolver list, and restart systemd-resolved:
sudo mkdir -p /etc/systemd/resolved.conf.d
cat << 'EOF' | sudo tee /etc/systemd/resolved.conf.d/pihole-no-stub.conf
[Resolve]
DNSStubListener=no
EOF
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo systemctl restart systemd-resolved
Verify that nothing remains bound to TCP or UDP port 53 on the host, and confirm your ISP allows direct outbound TCP/53 connections to root nameservers (required for large DNSSEC responses):
sudo ss -tulpn | grep :53
dig @198.41.0.4 . NS +norec +tcp +time=3 | grep -E 'status|flags'
The ss check must return completely blank output (Debian hosts typically return blank output already unless systemd-resolved or local dnsmasq was enabled manually). The dig probe to a.root-servers.net should return status: NOERROR with the aa (authoritative answer) flag, proving your ISP is neither hijacking nor dropping outbound DNS over TCP.
Step 2: Create the Hardened Unbound Config and .env Secrets
Organize your stack inside /opt/pihole-unbound with clean ownership and separated secrets before pulling container images. Mounting a tuned pi-hole.conf into /etc/unbound/custom.conf.d enforces DNSSEC hardening, QNAME minimisation, and RFC 1918 rebinding blocks, while isolating your dashboard password in a chmod 600 .env file keeps credentials out of compose.yaml.
Create the directory layout and assign Pi-hole’s data folder to UID/GID 1000:1000, which matches the default non-root runtime user configured by PIHOLE_UID and PIHOLE_GID inside Pi-hole v6:
sudo mkdir -p /opt/pihole-unbound/{etc-pihole,unbound}
sudo chown -R 1000:1000 /opt/pihole-unbound/etc-pihole
cd /opt/pihole-unbound
Write the hardened Unbound configuration at unbound/pi-hole.conf. Notice that root-hints and auto-trust-anchor-file are intentionally omitted here: klutchell/unbound:1.26.2 already ships updated root hints and the root.key trust anchor in its base /etc/unbound/unbound.conf, and duplicating those lines inside custom.conf.d triggers a second hints for zone . ignored warning on startup.
cat << 'EOF' | sudo tee /opt/pihole-unbound/unbound/pi-hole.conf
server:
verbosity: 0
interface: 0.0.0.0
port: 5335
do-ip4: yes
do-udp: yes
do-tcp: yes
# Enable IPv6 only if your Docker bridge and ISP provide working IPv6 routing
do-ip6: no
prefer-ip6: no
# Restrict queries strictly to container loopback (healthcheck) and the Docker DNS bridge
access-control: 127.0.0.0/8 allow
access-control: 172.30.53.0/24 allow
# Hardening & DNSSEC validation
hide-identity: yes
hide-version: yes
harden-glue: yes
harden-dnssec-stripped: yes
use-caps-for-id: no
qname-minimisation: yes
# Performance & DNS Flag Day fragmentation safety
edns-buffer-size: 1232
prefetch: yes
num-threads: 1
so-rcvbuf: 1m
# Protect LAN hosts from DNS rebinding attacks (RFC 1918 & local ranges)
private-address: 192.168.0.0/16
private-address: 169.254.0.0/16
private-address: 172.16.0.0/12
private-address: 10.0.0.0/8
private-address: fd00::/8
private-address: fe80::/10
private-address: 192.0.2.0/24
private-address: 198.51.100.0/24
private-address: 203.0.113.0/24
private-address: 255.255.255.255/32
private-address: ::ffff:0:0/96
EOF
sudo chmod 644 /opt/pihole-unbound/unbound/pi-hole.conf
Setting chmod 644 ensures the non-root 101:102 user inside the distroless klutchell/unbound:1.26.2 container can read the custom configuration cleanly without changing directory ownership to arbitrary UIDs. Next, create your .env secrets file and lock down its permissions:
cat << 'EOF' | sudo tee /opt/pihole-unbound/.env
TZ=Europe/London
PIHOLE_PASSWORD=ReplaceWithAStrongRandomPassphrase32Chars
EOF
sudo chmod 600 /opt/pihole-unbound/.env
Step 3: Deploy the Pi-hole v6 and Unbound Docker Compose Stack
Pin pihole/pihole:2026.11.0 and klutchell/unbound:1.26.2 together inside a single compose.yaml attached to a dedicated 172.30.53.0/24 Docker bridge network. Giving Unbound the static IP 172.30.53.53 eliminates container-restart race conditions, while Pi-hole v6 FTLCONF_* environment variables make your entire resolver configuration reproducible.
Three architectural details separate a rock-solid production stack from brittle forum snippets. First, pointing FTLCONF_dns_upstreams at the fixed bridge address 172.30.53.53#5335 instead of the Docker hostname unbound stops your entire LAN from losing DNS if Unbound restarts out of order or gets reassigned an ephemeral bridge IP. Pairing that static IP with drill-hc -p 5335 @127.0.0.1 dnssec.works and depends_on: condition: service_healthy guarantees Pi-hole waits until Unbound is actively resolving signed records.
Second, Pi-hole v6 consolidates all configuration into /etc/pihole/pihole.toml, so fresh installs only mount ./etc-pihole:/etc/pihole (skip /etc/dnsmasq.d unless migrating legacy v5 files with FTLCONF_misc_etc_dnsmasq_d: "true"). Any knob defined via FTLCONF_* becomes read-only inside the web dashboard so Compose remains your single source of truth. We also explicitly set FTLCONF_dns_dnssec: "false" because Unbound already validates every cryptographic chain from the root zone; letting Pi-hole validate a second time adds unnecessary DS/DNSKEY lookup latency and risks false BOGUS rejections.
Third, binding Pi-hole’s embedded CivetWeb interface to FTLCONF_webserver_port: "8080,8443s" leaves host ports 80 and 443 free. If you already run a reverse proxy on the same server, follow our Nginx Proxy Manager Docker setup guide to put your Pi-hole admin panel behind clean local HTTPS – and once proxied, you can tighten the port mappings below to 127.0.0.1:8080:8080/tcp so port 8080 is never exposed on your LAN interface. Save the following stack to /opt/pihole-unbound/compose.yaml:
services:
unbound:
image: klutchell/unbound:1.26.2
container_name: unbound
hostname: unbound
restart: unless-stopped
volumes:
- ./unbound:/etc/unbound/custom.conf.d:ro
networks:
dns_net:
ipv4_address: 172.30.53.53
healthcheck:
test: ["CMD", "drill-hc", "-p", "5335", "@127.0.0.1", "dnssec.works"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
cap_drop:
- ALL
cap_add:
- SETUID
- SETGID
security_opt:
- no-new-privileges:true
mem_limit: 256m
pihole:
image: pihole/pihole:2026.11.0
container_name: pihole
hostname: pihole
restart: unless-stopped
depends_on:
unbound:
condition: service_healthy
ports:
- "53:53/tcp"
- "53:53/udp"
- "8080:8080/tcp"
- "8443:8443/tcp"
environment:
TZ: ${TZ}
PIHOLE_UID: 1000
PIHOLE_GID: 1000
FTLCONF_webserver_api_password: ${PIHOLE_PASSWORD}
FTLCONF_webserver_port: "8080,8443s"
FTLCONF_dns_upstreams: "172.30.53.53#5335"
FTLCONF_dns_listeningMode: "all"
FTLCONF_dns_dnssec: "false"
FTLCONF_ntp_ipv4_active: "false"
FTLCONF_ntp_ipv6_active: "false"
FTLCONF_ntp_sync_active: "false"
volumes:
- ./etc-pihole:/etc/pihole
cap_add:
# Keep SYS_NICE for FTL priority; uncomment NET_ADMIN only if enabling Pi-hole DHCP
- SYS_NICE
# - NET_ADMIN
networks:
dns_net:
ipv4_address: 172.30.53.2
networks:
dns_net:
driver: bridge
ipam:
config:
- subnet: 172.30.53.0/24
Notice that the unbound service declares zero ports: mappings – only Pi-hole can reach port 5335 across the isolated dns_net subnet, so LAN devices can never bypass Pi-hole by querying Unbound directly. Launch the stack and confirm both containers come up healthy:
cd /opt/pihole-unbound
docker compose up -d
docker compose ps
Wait roughly 15–20 seconds for Unbound’s initial healthcheck probe to pass. Both unbound and pihole should display Up (healthy), and your dashboard is now reachable at http://<YOUR_SERVER_IP>:8080/admin.
Pi-hole v5 to v6 Environment Variable Migration Cheat Sheet
If you are upgrading an existing Pi-hole v5 Compose stack, replace deprecated v5 keys with their exact v6 FTLCONF_* equivalents before recreating your container:
| Deprecated Pi-hole v5 Variable | Pi-hole v6 Equivalent | Required Value / Format |
|---|---|---|
WEBPASSWORD | FTLCONF_webserver_api_password | Loaded via ${PIHOLE_PASSWORD} from .env (read-only in UI) |
PIHOLE_DNS_ | FTLCONF_dns_upstreams | Semicolon-delimited with #port, e.g., 172.30.53.53#5335 |
DNSMASQ_LISTENING | FTLCONF_dns_listeningMode | all for Docker bridge networks |
WEB_PORT | FTLCONF_webserver_port | Comma-separated ports with s for TLS, e.g., 8080,8443s |
Step 4: Verify Ad Blocking and Cryptographic DNSSEC Validation
Never switch your router over to Pi-hole until terminal tests confirm every link in the chain works. Three targeted dig commands verify valid DNSSEC resolution through Unbound, strict SERVFAIL rejection of forged cryptographic signatures, and clean 0.0.0.0 NULL blocking by Pi-hole’s Gravity database.
First, confirm Unbound parsed pi-hole.conf without syntax warnings, then run the three verification probes against Pi-hole on localhost:
# 0. Sanity-check Unbound config syntax (must print "no errors")
docker exec unbound unbound-checkconf
# 1. Confirm valid DNSSEC resolution returns NOERROR + RRSIG records
dig @127.0.0.1 dnssec.works +dnssec
# 2. Confirm broken/spoofed DNSSEC signatures are dropped with SERVFAIL
dig @127.0.0.1 fail01.dnssec.works
# 3. Confirm Pi-hole Gravity sinkholes ad domains to 0.0.0.0
dig @127.0.0.1 ads.google.com
Check the header and answer sections of each response against these expected results:
- Test 1 (
dnssec.works +dnssec): Returnsstatus: NOERRORalongside anArecord and cryptographicRRSIGsignature. Because we keptFTLCONF_dns_dnssec: "false"to prevent double validation, Pi-hole’s embeddeddnsmasqclears theadflag on forwarded replies per RFC 4035. To inspect Unbound’s rawad(Authenticated Data) flag directly inside the container, rundocker exec unbound drill -D -p 5335 @127.0.0.1 dnssec.works– you will seeflags: qr rd ra ad. - Test 2 (
fail01.dnssec.works): Returnsstatus: SERVFAILwithANSWER: 0. Unbound cryptographically verified the signature mismatch and refused to pass the tampered IP to Pi-hole. - Test 3 (
ads.google.com): Returnsstatus: NOERRORresolving immediately to0.0.0.0in0–1 msec, proving Pi-hole’s NULL blocking mode intercepted the ad tracker before it ever touched Unbound.
Run dig @127.0.0.1 dnssec.works a second time right away: the first cold recursive walk takes roughly 150–350 ms as Unbound traverses root, TLD, and authoritative servers, while the cached second query drops straight to 0 msec.

Step 5: Configure Router DHCP DNS and High-Signal Blocklists
Assign your Docker host’s static LAN IP inside your router’s LAN DHCP DNS field rather than WAN DNS so Pi-hole logs individual client devices cleanly. Leave the Secondary DNS slot blank to prevent traffic leaks, then add one curated wildcard blocklist such as HaGeZi Multi PRO or OISD Big.
Always give your Docker server a static DHCP lease (or static netplan IP) on your LAN before changing router DNS settings. When configuring your router, distinguish between two similarly named menus:
- LAN / DHCP Server DNS (Recommended): Your router hands Pi-hole’s IP directly to laptops, phones, and smart TVs during DHCP lease renewal. Every device queries Pi-hole directly, letting you view per-client traffic and assign separate blocking groups.
- WAN / Internet DNS (Fallback only): Devices still query your router, which forwards everything to Pi-hole. Ad blocking works, but every query in your Pi-hole dashboard appears under your router’s IP address, hiding which IoT device is spamming telemetry.
Many locked-down ISP hubs deliberately hide or grey out custom LAN DHCP DNS controls. If your provider’s hub refuses to advertise a local DNS server, our walkthrough on replacing ISP routers with OPNsense or third-party hardware shows how to put your modem in bridge mode and regain full LAN DHCP authority. Crucially, never enter 1.1.1.1 or 8.8.8.8 as a Secondary DNS server: operating systems treat primary and secondary DNS servers as equal peers rather than strict failovers, quietly routing a large slice of ad queries around Pi-hole. Leave Secondary DNS empty (or repeat Pi-hole’s IP if your router requires two entries), and keep your server IP handy in case you ever need to revert manually.
Next, log into http://<YOUR_SERVER_IP>:8080/admin and resist the urge to paste thirty overlapping hosts files. Stacking millions of unmaintained domains creates constant website breakage without blocking meaningfully more ads. Because Pi-hole v6 natively parses Adblock Plus wildcard rules (||example.com^) that sweep up tracking subdomains cleanly, a single actively curated list alongside the default StevenBlack list is all most home networks need. Under Lists, paste one of these URLs, click the red Add blocklist button (not the green allowlist button), and rebuild Gravity:
- HaGeZi Multi PRO (strong ad, tracker & smart TV telemetry blocking):
https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt - OISD Big (strictly vetted for near-zero false positives):
https://big.oisd.nl
docker exec pihole pihole -g
Once your household depends on self-hosted DNS, treat it like core infrastructure. Add an automated DNS query check using our Uptime Kuma Docker monitoring guide so you get instant alerts if resolution ever stalls, and pair it with Beszel lightweight server monitoring to track container CPU, memory growth, and disk I/O without bloating your homelab node.
Frequently Asked Questions
Why did docker compose up fail with “bind: address already in use” on port 53 on Ubuntu?
Ubuntu runs systemd-resolved on 127.0.0.53:53 by default, blocking Docker from binding host port 53. Create /etc/systemd/resolved.conf.d/pihole-no-stub.conf with DNSStubListener=no, symlink /etc/resolv.conf to /run/systemd/resolve/resolv.conf, restart systemd-resolved, and confirm sudo ss -tulpn | grep :53 returns empty before restarting Docker Compose.
Why should I use klutchell/unbound:1.26.2 instead of mvance/unbound in Docker?
mvance/unbound has received no updates since October 2024, leaving it stuck on Unbound 1.21.1 in a ~92 MB amd64-only image with outdated static root anchors. klutchell/unbound:1.26.2 is a ~6.7 MB distroless multi-arch (amd64/arm64) build running non-root (101:102) with NLnet Labs Unbound 1.26.2 and built-in drill-hc healthchecks.
Should I enable Pi-hole’s DNSSEC checkbox when using Unbound as my upstream resolver?
Keep FTLCONF_dns_dnssec: "false" when Unbound is your only upstream resolver. Unbound already validates every DNSSEC signature from the root zone and drops spoofed records with SERVFAIL. Enabling DNSSEC inside Pi-hole forces redundant DS/DNSKEY lookups, adds latency, and can cause false BOGUS failures without adding security.
Why do my old Pi-hole v5 variables like WEBPASSWORD and PIHOLE_DNS_ stop working in Pi-hole v6?
Pi-hole v6 replaced legacy setup scripts and separate config files with a unified /etc/pihole/pihole.toml schema mapped directly to FTLCONF_<section>_<key> environment variables. Replace WEBPASSWORD with FTLCONF_webserver_api_password, PIHOLE_DNS_ with FTLCONF_dns_upstreams, and DNSMASQ_LISTENING with FTLCONF_dns_listeningMode.
What happens if I set Cloudflare 1.1.1.1 as my router’s Secondary DNS alongside Pi-hole?
Most desktop and mobile operating systems treat Primary and Secondary DNS entries as interchangeable peers rather than strict failover backups. Adding 1.1.1.1 as a secondary server causes clients to send ads and tracker queries straight to Cloudflare even while Pi-hole is online. Leave Secondary DNS blank or deploy a second Pi-hole node.
Why are the first DNS lookups slightly slower on Unbound, and does caching fix it?
Unlike public resolvers sharing warm caches across millions of users, a fresh Unbound instance walks the authoritative hierarchy from root servers down for each uncached domain – typically taking 150–350 ms. Once resolved, both Unbound and Pi-hole cache the record locally, dropping repeat queries to 0–1 ms while prefetch: yes refreshes popular domains before expiration.

Leave a Reply