Introduction
Pi-hole is a powerful network-wide ad blocker, but it can also be used as a local DNS server for development. This allows you to resolve custom domain names (e.g., nextcloud.local) to your local development website server, making it easier to access services on your network without remembering IP addresses.
In this guide, we will walk you through setting up Pi-hole in Docker on Windows (using WSL) and configuring it to resolve local domains for your development environment.
Prerequisites
- Windows with WSL 2 and docker installed
- Docker running in WSL 2

A working local server (e.g., Nginx, Apache, or any web service)
Step 1: Install and Run Pi-hole in Docker
1.1 Create a docker-compose.yml File
Create a folder for Pi-hole and navigate into it:
mkdir ~/pihole && cd ~/pihole
Now, create a docker-compose.yml file:
version: '3'
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
networks:
- pihole_net
ports:
- "53:53/tcp"
- "53:53/udp"
- "8080:80/tcp" # 8080 for http traffic
- "8443:443/tcp" # 8443 system port for https
environment:
TZ: 'America/Los_Angeles' # Your/Timezone
FTLCONF_webserver_api_password: 'yourpassword' # admin panel password
FTLCONF_dns_listeningMode: 'all'
volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
cap_add:
- NET_ADMIN
restart: unless-stopped
networks:
pihole_net:
driver: bridge
We have Changed web interface to 8080
for avoiding conflicts with other websites.
1.2 Start Pi-hole
Run the following command to start Pi-hole:
docker compose up -d
Pi-hole should now be running on http://localhost:8080/admin.
Step 2: Configure Your other System to Use Pi-hole as DNS
2.1 Find Your WSL IP Address
Use this IP on the same system your docker is running for when you don’t want to edit host file on your windows.
Run:
ip a | grep eth0
Look for the IP under eth0, e.g., 192.168.1.100.
2.2 Find Your Machine’s Local Network IP for use on other devices.
To make Pi-hole accessible to all devices on your network, you need to find your machine’s local network IP:
ipconfig getifaddr en0 # macOS
ip a | grep inet # Linux
ipconfig # Windows (look for 'IPv4 Address' under your active network connection)
Example output: 192.168.1.100. This is the IP that other devices on your network should use as their DNS.
2.3 Set Pi-hole as Your DNS
Windows:
- Open Settings → Network & Internet → Ethernet/Wi-Fi
- Click Edit under “IP Settings”
- Set Preferred DNS to your machine’s local IP (e.g., 192.168.1.100)
Mac & iOS:
- Open System Preferences → Network
- Select Wi-Fi → Advanced → DNS
- Add your machine’s local IP (e.g., 192.168.1.100)
Android:
- Open Wi-Fi settings
- Select Advanced Options
- Set DNS 1 to your machine’s local IP
Other Devices:
For any device on your network, manually set the DNS server in its network settings to the IP of your Pi-hole instance (e.g., 192.168.1.100). This ensures that all devices resolve custom local domains through Pi-hole.
Change Admin Panel Password
If you forget or need to change the password you can access the exec bash console for pi-hole docker container and reset or remove password as following:
/ # bash
291a3123c509:/# sudo pihole setpassword
Enter New Password (Blank for no password):
[✓] Password Removed
291a3123c509:/# ^C
291a3123c509:/#

Leave a Reply