Skip to content

Instantly share code, notes, and snippets.

@xenithorb
Last active August 16, 2019 07:21
Show Gist options
  • Save xenithorb/ce2562113a9efdbd5a3d2b8e11e37b65 to your computer and use it in GitHub Desktop.
Save xenithorb/ce2562113a9efdbd5a3d2b8e11e37b65 to your computer and use it in GitHub Desktop.
My preferred way of running a standalone pihole on an atomic host instance.
NAME=pihole
TERM=xterm-256color
TAG='latest'
TZ="America/New_York"
DNS1=10.0.0.1
DNS2=10.0.0.1
IP=10.0.0.14
docker pull diginc/pi-hole:${TAG} &&
docker rm -f ${NAME}
#docker volume ls | awk '/pihole-/{ print $2 }' | xargs docker volume rm
docker run -d \
--name ${NAME} \
$(awk '/nameserver/{print "--dns",$2}' /etc/resolv.conf) \
-v /run \
-v "${NAME}-config:/etc/pihole/:Z" \
-v "${NAME}-dnsmasq:/etc/dnsmasq.d/:Z" \
-p 53:53/tcp -p 53:53/udp -p 80:80 \
-e TZ="${TZ}" \
-e ServerIP="${IP}" \
-e DNS1="${DNS1}" -e DNS2="${DNS2}" \
-e LIGHTTPD_ENABLED=true \
--restart=always \
-e TERM=${TERM} \
diginc/pi-hole:${TAG}
sleep 1
docker logs ${NAME} 2>/dev/null | grep 'password:'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment