Setting up Pi-hole
Nothing exotic here, but port 53 is almost always already in use, worth checking before the container refuses to start.
- 1
Free up port 53 first
Most Linux desktops run systemd-resolved, which already listens on port 53 and will collide with Pi-hole's own DNS listener. Disabling its stub listener (without disabling the rest of systemd-resolved) clears the port.
sudo sed -i 's/#DNSStubListener=yes/DNSStubListener=no/' /etc/systemd/resolved.conf sudo systemctl restart systemd-resolved - 2
Run the container
It needs both TCP and UDP on port 53 for DNS, plus a port for the web interface.
services: pihole: image: pihole/pihole:latest container_name: pihole restart: unless-stopped environment: - TZ=America/New_York - WEBPASSWORD=change-this ports: - "53:53/tcp" - "53:53/udp" - "8080:80" volumes: - ./etc-pihole:/etc/pihole - ./etc-dnsmasq.d:/etc/dnsmasq.d - 3
Point the router at it
In the router's DHCP settings, set the DNS server to this machine's IP address instead of the ISP's default. Every device that gets an address from DHCP picks it up automatically, no per-device setup.
- 4
Add blocklists
The web UI (port 8080 above) comes with one default blocklist; Group Management → Adlists is where more community-maintained lists get added for broader coverage.
Further reading
- Pi-hole documentation
Full setup and troubleshooting reference, including the DNSStubListener conflict covered above.
- Pi-hole on GitHub
Source and the official Docker image documentation.