- Pihole run script
- Pihole service script
Last active
June 7, 2020 09:25
-
-
Save Madh93/123b43ede07d0f61d10a4c5eaa80dc22 to your computer and use it in GitHub Desktop.
Pi-hole scripts in Docker
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
[Unit] | |
Description=Run Pi-hole in a Docker container | |
Requires=docker.service multi-user.target | |
After=docker.service network-online.target dhcpd.service | |
[Service] | |
Type=simple | |
Restart=always | |
PIDFile=/var/run/pihole.pid | |
ExecStartPre=/bin/rm -f /var/run/pihole.pid | |
ExecStart=/usr/local/bin/pihole | |
ExecStop=/usr/bin/docker stop -t 2 pihole | |
[Install] | |
WantedBy=multi-user.target |
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 | |
# https://github.com/diginc/docker-pi-hole/blob/master/docker_run.sh | |
MY_USER="migue" | |
DOCKER_CONFIGS="/home/$MY_USER/.pihole" # Default of directory you run this from, update to where ever. | |
if [ -n "$(docker ps -a -q --filter name=pihole)" ]; then | |
docker start -a pihole | |
else | |
# Default ports + daemonized docker container | |
docker run -d \ | |
--name pihole \ | |
-p 53:53/tcp -p 53:53/udp -p 80:80 \ | |
-v "${DOCKER_CONFIGS}/pihole/:/etc/pihole/" \ | |
-v "${DOCKER_CONFIGS}/dnsmasq.d/:/etc/dnsmasq.d/" \ | |
-e ServerIP="${IP:-$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')}" \ | |
diginc/pi-hole-multiarch:debian_armhf | |
docker logs pihole 2> /dev/null | grep 'password:' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment