Pi-hole and Docker on MacOS to get rid of pesky advertising

  • August 21, 2019
  • August 23, 2019

When I’m at home I have setup a Raspberry Pi to run Pi-hole and block pesky advertising.

But. I am not always at home. I also bring my Macbook to work, customers, airports & hotels. I didn’t want to clutter up my system and install Pi-hole natively, so instead I used Docker

To make starting/stopping Pi-hole easier I created a small shell script:

case "$1" in
        docker pull pihole/pihole
        exit 0
        docker start pihole 2>&1 >/dev/null || docker run -d --name pihole -e WEBPASSWORD="Gloryhole" -e DNS1= -e DNS2= -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp pihole/pihole:latest 2>&1 >/dev/null
        networksetup -setdnsservers Wi-Fi
        echo "Started Pihole"
        exit 0
        docker stop pihole 2>&1 >/dev/null
        networksetup -setdnsservers Wi-Fi
        echo "Stopped Pihole"
        exit 0
        echo "Usage: $0 <install|start|stop>" >&2
        exit 1

More documentation on the Docker image can be found on GitHub: https://github.com/pi-hole/docker-pi-hole/#running-pi-hole-docker