Created
July 15, 2019 19:59
-
-
Save Riebart/e76df1baef87f4041867ec3a0874ee7b to your computer and use it in GitHub Desktop.
Start a PiHole docker container with the appropriate upstream DNS and server IPs autodetected.
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 | |
docker run --rm -d --name pihole \ | |
-p 53:53/tcp -p 53:53/udp -p 80:80 \ | |
-v /home/pihole/etc/pihole:/etc/pihole/ \ | |
-v /home/pihole/etc/dnsmasq.d:/etc/dnsmasq.d/ \ | |
--dns $(nslookup 1.1.1.1 | \ | |
grep Server: | tr -s '\t' | \ | |
cut -f2) \ | |
-e DNS1=$(nslookup 1.1.1.1 | \ | |
grep Server: | tr -s '\t' | cut -f2) \ | |
-e DNS2=no \ | |
-e ServerIP=$(ip route list | \ | |
grep "^default" | cut -d ' ' -f7,9 | sort -t ' ' -k2 | \ | |
head -n1 | cut -d ' ' -f1) \ | |
pihole/pihole:latest | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment