PiHole Docker Guide

How to block ads at home

Ads can take the user’s attention away from the content they are trying to consume, which can be frustrating.

PiHole can help us by blocking ads, improve the browsing experience and protect your privacy and security online.

Changing DNS Settings - Windows 10

setting > Network & Internet > Change adapter options

With the command line, you will be able to check if the DNS updated properly:

ipconfig /all

PiHole - Docker container:

The configuration file that we will use today is:

Deploy with CLI

Providing that the previous steps are clear, we can jump to our terminal and use:

sudo nano docker-compose.yml

This will open a text editor, where we can paste the following configuration file:

To save, use CTRL+O, then CTRL+X to exit.

Then just deploy the service with:

sudo docker-compose up -d

You are ready to use PiHole, the service will be running in or localhost:80/admin if you used the configuration file as it is provided.

PiHole - Configuration

Interested to discover similar services that you can self-host with Docker? - Check this out:

Testing PiHole - Is my ad-blocker working?

By default, PiHole will be blocking some adds, but how well is our new ad-blocker doing? For that we can use:

Tweaking PiHole - Customizing the block list

In our PiHole Admin panel, we can go to Adlists:


How can I check if the new DNS server is working?

#try google.com and see the DNS used

This should already give entries to the pihole dashboard at http://your_local_ip/admin/index

How to list the DNS servers used?

resolvectl status | grep "DNS Server" -A2

How to check what is using already port 53?

netstat -tulpn | grep LISTEN

or with:

sudo ss -tuln | grep :53

How can I stop systemd-resolved process at port 53?

sudo systemctl stop systemd-resolve
systemctl disable systemd-resolved.service

How to check services running?

systemctl --type=service --state=running

I had to do:

sudo systemctl stop dnsmasq.service
systemctl disable dnsmasq.service

How to know my local IP?

hostname -I

What if I need to add my IPv6 address too?

You can check your raspberry IPV6 with:


The inet value is the ipv4 and the inet6 is the raspberry Pi IPV6

How can I check the local ip of my Android device?

Settings > Wifi > Select your Connection > Scroll down and check IP address: You will see something like

How to get UID and GUI?

id pi #id <your username>