Skip to content

Instantly share code, notes, and snippets.

@FerPerales
Forked from PiotrKrzyzek/pihole_run.sh
Created August 13, 2020 14:16
Show Gist options
  • Save FerPerales/c3c9981370f2ccd9bda64910ec5211c7 to your computer and use it in GitHub Desktop.
Save FerPerales/c3c9981370f2ccd9bda64910ec5211c7 to your computer and use it in GitHub Desktop.
Config and run pihole in Docker on MacOS
#!/bin/bash
# I've set this up to use my static IP, instead of dynamically getting one.
# Why? Because if my IP keeps changing, then how is the router supposed to constantly find it?!
# I set a static IP for this computer, and that is that.
IP="YOUR local static IP here"
# Default of directory you run this from, update to where ever.
DOCKER_CONFIGS="~/.pihole"
docker run -d \
-p 53:53/tcp -p 53:53/udp \
-p 67:67/udp \
-p 80:80 \
-p 443:443 \
-e ServerIP="${IP}" \
--restart=unless-stopped \
--cap-add=NET_ADMIN \
--dns=127.0.0.1 --dns=1.1.1.1 \
-v "${DOCKER_CONFIGS}/pihole/:/etc/pihole/" \
-v "${DOCKER_CONFIGS}/dnsmasq.d/:/etc/dnsmasq.d/" \
-e WEBPASSWORD="YOUR PASSWORD HERE" \
pihole/pihole:latest
# Q&A
## Why is the password set here?
# I was tired of having to always find the password. So, since I only have access to the system
# I just set it to something I know
## Where did you put this file?
# I placed it into the ".pihole" folder in my users home directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment