Skip to content
NetworkingBeginner

How to Set Up Pi-hole for Network-Wide Ad Blocking

Install Pi-hole with Docker to block ads and trackers for every device on your home network.

by HomeServersGuide Team1 min read

Pi-hole blocks ads and trackers at the DNS level for every device on your network — no client software required. Here's how to run it with Docker.

Prerequisites

  • A home server with Docker installed
  • A static IP for the server (set a DHCP reservation on your router)

Step 1: Create the Compose file

services:
  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "8090:80/tcp"
    environment:
      TZ: "Europe/Berlin"
      WEBPASSWORD: "change-me"
    volumes:
      - ./etc-pihole:/etc/pihole
      - ./etc-dnsmasq.d:/etc/dnsmasq.d
    restart: unless-stopped

Step 2: Start Pi-hole

docker compose up -d

Step 3: Open the dashboard

Go to http://your-server-ip:8090/admin and log in with the password you set.

Step 4: Point your network at Pi-hole

The best option is to set Pi-hole as the DNS server in your router's DHCP settings, so every device uses it automatically. Alternatively, set it per-device.

Step 5: Verify it's working

Browse a few sites — many ads should vanish. The dashboard shows queries and the percentage blocked in real time.

Tips

  • Add reputable blocklists under Adlists, but don't overdo it to avoid breakage.
  • Use the allowlist to fix any site that misbehaves.
  • Consider AdGuard Home if you want encrypted DNS built in.

That's it — one small container now cleans up browsing for your whole home.

Related articles

NetworkingIntermediate

Home Server Networking Guide

Reverse proxies, DNS, VLANs and secure remote access — give your services clean, reachable names the right way.

1 min read
Getting StartedBeginner

The Complete Home Server Beginner's Guide

Go from zero to a running home server: choose hardware, pick an operating system, deploy your first apps, and keep everything secure and backed up.

2 min read
ContainersBeginner

How to Install Docker on Ubuntu

A step-by-step tutorial to install Docker Engine and Docker Compose on Ubuntu Server, then run your first container.

1 min read