Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 123.123.123.123 password"
echo "Specify your host's LAN IP and the desired Pihole password"
exit 1
fi
IP=$1
PASSWORD=$2
docker run -d -it --restart always --name stubby -p 8053:8053/udp mvance/stubby:latest
docker network create --subnet 172.18.0.0/16 dns
docker network connect dns stubby --ip 172.18.0.3
echo "### Make sure your IPs are correct, hard code ServerIP ENV VARs if necessary\nIP: ${IP}\nIPv6: ${IPv6}"
set -x
# Default ports + daemonized docker container
docker run -d \
--name pihole \
-p $IP:53:53/tcp -p $IP:53:53/udp \
-p 67:67/udp \
-p 80:80 \
-p 443:443 \
-v pihole:/etc/pihole/ \
-v dnsmasq.d:/etc/dnsmasq.d/ \
-e ServerIP="${IP}" \
-e DNSMASQ_LISTENING=${IP} \
-e WEBPASSWORD="${PASSWORD}" \
--restart=unless-stopped \
--cap-add=NET_ADMIN \
--dns=172.18.0.3 \
pihole/pihole:latest
echo -n "Your password for https://${IP}/admin/ is "
docker logs pihole 2> /dev/null | grep 'password:'
docker network connect dns pihole --ip 172.18.0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment