PiHole on Docker


I've had a proper ball-ache getting this one working. There seems to be loads of tutorials out there, but none of them worked straight up for me, and this is as much a note for myself as anything else. The version of Docker that I'm running really doesn't seem to like the environmental variables (-e) so I've had to configure those from the GUI.



I'm running on Ubuntu server 20.04, so turning off the internal DNS resolution was needed:

sudo systemctl stop systemd-resolved.service

sudo systemctl disable systemd-resolved.service

sudo nano /e tc/resolv.conf

change 127.0.0.1 to a working DNS server.

After that, my finally working Docker script is:

sudo docker run -d \

   --name pihole \

   -p 53:53/tcp -p 53:53/udp \

   -p 80:80 \

   -p 443:443 \

   -v "/docker_data/docker/pihole/:/docker_data/docker/pihole/" \

   -v "/docker_data/docker/dnsmasq.d/:/docker_data/docker/dnsmasq.d/" \

   --restart=unless-stopped \

   --cap-add=NET_ADMIN \

   --dns=127.0.0.1 --dns=192.168.111.10 \

   pihole/pihole:latest


I'm using Portainer for container management and was able to get the web password from the container log there.

Enjoy!

Rob Stevens

Rob Stevens

Tyne and Wear, UK