Run pi-hole using docker

While there are many DNS level adblockers available out there, Pi-hole clearly stands out for multiple reasons:

  1. It gives you stats and graphs of all the DNS data which is amazing
  2. It gives you a web interface using which you can selectively black list or whitelist websites and that makes things really easy.

For these reasons I prefer using pi-hole over any other DNS level adblocker. Recently I deployed pi-hole on my Server on digital ocean and it ran really well for a month but then I noticed that some hackers started using it for DNS Amplification Attack  and hence I had to shut it down. There are a lot of free DNS Servers available which provide adblocking but they are very unreliable and slow most of the times. While at home I had no issues because my raspberry pi does a great job but when I am on the move I feel the absence of it. So I wanted to find a reliable long term solution and came up with this.

Well, all thanks to this : . They have made a very nice alpine based docker image for pi-hole and that makes things so simple. So essentially I can run pi-hole on my laptop itself using docker.

docker run  –name=pihole –restart=always -d diginc/pi-hole:debian
docker inspect pihole | grep IPAddress

Let’s assume you get the IP Address as

Now go to your network manager and change the default DNS Server for your wifi



That’s it, reconnect to your WIFI/Ethernet and you are done 🙂  Please remember that if you use multiple Wifi/Ethernet connections then you have to change DNS for all of them in Network Manager like we did for one Wifi above.

I also blogged about blocking adverts on your entire home network using Raspberry pi. It can be seen here:: How I use raspberry pi at my home to block advertisements on all devices and load webpages fast!