Skip to content

Instantly share code, notes, and snippets.

@mwyau
Last active October 27, 2018 00:32
Show Gist options
  • Select an option

  • Save mwyau/99bd9c25479c1b38973479091de9a78b to your computer and use it in GitHub Desktop.

Select an option

Save mwyau/99bd9c25479c1b38973479091de9a78b to your computer and use it in GitHub Desktop.
Pi-Hole Docker script
#!/bin/bash
# Just hard code these to your docker server's LAN IP if lookups aren't working
IP="192.168.1.2" # use $IP, if set, otherwise IP_LOOKUP
# Default of directory you run this from, update to where ever.
DOCKER_CONFIGS="$(pwd)"
echo "### Make sure your IPs are correct, hard code ServerIP ENV VARs if necessary\nIP: ${IP}\nIPv6: ${IPv6}"
# Default ports + daemonized docker container
docker run -d \
--name pihole \
-p 53:53/tcp -p 53:53/udp \
-p 67:67/udp \
-p 80:80 \
-p 443:443 \
-v "${DOCKER_CONFIGS}/pihole/:/etc/pihole/" \
-v "${DOCKER_CONFIGS}/dnsmasq.d/:/etc/dnsmasq.d/" \
-e ServerIP="${IP}" \
-e TZ="America/New_York" \
-e WEBPASSWORD="" \
--restart=unless-stopped \
--cap-add=NET_ADMIN \
--dns=127.0.0.1 --dns=1.1.1.1 \
pihole/pihole:latest
echo -n "Your password for https://${IP}/admin/ is "
docker logs pihole 2> /dev/null | grep 'password:'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment