Let’s setup Pi-Hole in Docker, following the official documentation.
getconf LONG_BIT
check for 32bit or 64bit.cat /etc/os-release
check the version of the OS.
After following the installation guide, you might receive these errors:
E: Package 'docker-ce' has no installation candidate
E: Unable to locate package docker-ce-cli
E: Unable to locate package containerd.io
E: Couldn't find any package by glob 'containerd.io'
E: Couldn't find any package by regex 'containerd.io'
E: Unable to locate package docker-buildx-plugin
E: Unable to locate package docker-compose-**plugin**
Switch over to this guide to manually install docker with the deb files.
- Download all five deb files, get the latest versions.
sudo dpkg -i *
to install all five deb files.sudo service docker start && sudo docker run hello-world
to make sure it’s working.
Now Docker’s installed, let’s get a container of Pi-Hole setup following this.
mkdir pihole
andcd pihole && touch docker-compose.yml
, copy paste the example.- Adjust ports, TZ and cap_add if you’re not using DHCP.
sudo docker compose up -d
and- Check the ports worked with
sudo docker ps
under the ports column orsudo docker port $containerID
.
If there’s no ports mapped, check the logs sudo docker logs -f $containerID
Looks like the container is always restarting.
You might be having a known issue with libseccomp2 v2.3.3-4.
This shows a short-term fix which works.
Add the following to your docker-compose.yml file.
security_opt:
- seccomp=unconfined
Then stop, remove and recompose Pi-Hole.
sudo docker stop $containerID
sudo docker rm $containerID
- Rerun
sudo docker compose up -d
andsudo docker ps
to check.
Run sudo netstat -ntlp
to see a list of ports and services.
If you’re still having issues, see here for another option.
To set the web interface password sudo docker exec -it $containerID pihole -a -p
Update Router
To get your modem/router to use Pi-Hole, update your router settings.
Find the IP of your router (default gateway). On linux ifconfig
, ip a
or ipconfig
on Windows.
Go to the web dashboard http://$routerIP/ and search for LAN. The name may differ for your router.
Update the DNS or nameserver to the IP of your Pi-Hole system.
Now you should start to see queries! Head over to YouTube and watch those ads disappear!
Can’t SSH after installing Pi-Hole
Next issue, can’t ssh back into the system running Pi-Hole?
Check what services and ports are exposed with nmap -Pn $ip
from another system.
Can you see SSH? If not, then it’s disabled.
On your system with Pi-Hole:
sudo apt install ufw
to install an easier interface for the firewall.sudo ufw allow ssh
to allow ssh connections
Warning: no upstream servers configured
If you see “warning: no upstream servers configured”, go to Settings > DNS.
Select whatever IPv4 and IPv6 Upstream DNS Servers you want like Google or OpenDNS.
Thanks for reading.