Created
December 17, 2018 03:24
-
-
Save PiotrKrzyzek/8a5cf195a34e9f37fdbef811e83fae2f to your computer and use it in GitHub Desktop.
Config and run pihole in Docker on MacOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
This was really helpful, thanks! I used this on a Mac running Docker v2.3.0.2, Catalina v10.15.5.
When I ran the script it choked on ~, changing to an explicit path worked.