Web ads suck. Web browsing has become a terrible game of “dodge the ads” and the actual web browsing experience has been marred by the use of sub-optimal ad distributions. From annoying, auto-playing video ads to full-screen take over ads on mobile devices, they simply suck.

Well, I have found a solution, and this is how I got it setup and running.

Prerequisite: Docker server – While you can definitely install this application as either a dedicated appliance application, or as a simple slave application (traditional host install), this guide will cover the installation of it running on a docker server. There are versions of this that can run directly on a raspberry pi, hence the name. If you are looking for that solution, please visit their site directly: https://pi-hole.net/

Editor Note: There is no “perfect” solution for ad-blocking that is 100% effective. This solution simply block the hosts of the web-ad services so they simply cannot connect to them from your devices. This may cause issues with the way certain websites function (redirects) along with possibly impacting the design and layout of certain sites that hadn’t planned for the ads to not be present.

DOCKER-COMPOSE:

The following docker-compose.yml file is the lowest barrier to entry for this system. Be sure to update the values to customize things to your liking.

version: "3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80:80/tcp"
      - "443:443/tcp"
    environment:
      TZ: 'America/Chicago'
      WEBPASSWORD: 'changeMe!'
    # Volumes store your data between container upgrades
    volumes:
      - './etc-pihole/:/etc/pihole/'
      - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
    dns:
      - 127.0.0.1
      - 1.1.1.1
    # Recommended but not required (DHCP needs NET_ADMIN)
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN
    restart: unless-stopped

Once this is up and running, you will need to add in an RBL list (blacklist). There are MANY of them available all over the web, simply search for “pi-hole blacklists” (link). I personally use the following:

https://raw.githubusercontent.com/ookangzheng/dbl-oisd-nl/master/dbl.txt

After this has all been completed, simply point your computer’s DNS addresses (in network settings) to the IP address of your docker server. Alternatively, you can change the DNS settings on your router to automatically tell the computers on your network to use PI-Hole as the DNS.

Occasionally things will get blocked that you do not wish to have blocked. To prevent these from being blocked in the future, log into the interface and click on “Query Log” and fine the URL listed in RED that you wish to unblock, and click the “Whitelist” button on the far right. You can also manually add it to the whitelist by clicking “Whitelist” in the menu on the left and use the form on that page to add a domain.

There are TONS of configuration options for this tool, and while the concept is simple, it is extremely powerful. Feel free to poke around and see what options there are and how they might improve your experience.