Hackernoon logoThere is pi(hole) on your Dockers. How to stop ads with a pihole: Raspbian and Docker version! by@mikefettis

There is pi(hole) on your Dockers. How to stop ads with a pihole: Raspbian and Docker version!

mike fettis Hacker Noon profile picture

@mikefettismike fettis


When writing this blog post, originally I was just going to talk about installing pihole on raspbian. But then I found out that pihole can run in docker. Personally I love my raspberry pis but I’d rather not have another piece of hardware in the lab when there is a perfectly good docker host.

Instead of getting all wordy with the install lets cut right to the chase with the TLDR version to get it running on a pi and in docker. Enjoy, an explanation will follow.

Alright now we have installed pihole and it is running and blocking ads on our local network. But what is it doing and how? Some people may not care how it works, those out there that do care, keep reading.

Pihole consists of a number of systems that make it work, the heavy lifters are core, gravity, and ftldns. The docs for pihole state,“The core script of Pi-hole provides the ability to tie many DNS related functions into a simple and user friendly management system, so that one may easily block unwanted content such as advertisements.” Ftldns is the dns engine that is powering everything. This means ftldns is going to act as a forwarding dns server, where if it doesn’t know a dns response it will forward it on. However when it detects a dns entry for an ad network, pihole will not forward that request on, and simply blackhole it. There are also a number of more user friendly commands for adding custom entires, updating and managing the dns server. Then the gravity module is the feature that allows for all the custom whitelists and blacklists to be fed into the system. The gravity module also supports a variety of regex for your own custom entries.

Thats pretty much it. There is much more in the weeds on each of these subsystems but then its reading documentation. All the documentation link have been included below.


Join Hacker Noon

Create your free account to unlock your custom reading experience.