#!/bin/bash # https://github.com/pi-hole/docker-pi-hole/blob/master/README.md PIHOLE_BASE="${PIHOLE_BASE:-$(pwd)}" [[ -d "$PIHOLE_BASE" ]] || mkdir -p "$PIHOLE_BASE" || { echo "Couldn't create storage directory: $PIHOLE_BASE"; exit 1; } [[ -d "$PIHOLE_BASE/etc-pihole" ]] || mkdir -p "$PIHOLE_BASE/etc-pihole" || { echo "Couldn't create storage directory: $PIHOLE_BASE/etc-pihole"; exit 1; } [[ -d "$PIHOLE_BASE/etc-dnsmasq.d" ]] || mkdir -p "$PIHOLE_BASE/etc-dnsmasq.d" || { echo "Couldn't create storage directory: $PIHOLE_BASE/etc-dnsmasq.d"; exit 1; } # Note: ServerIP should be replaced with your external ip. docker run -d \ --name pihole \ -p 6053:53/tcp -p 6053:53/udp \ -p 6080:80 \ -p 6443:443 \ -e TZ="Europe/Amsterdam" \ -v "${PIHOLE_BASE}/etc-pihole:/etc/pihole:U,z" \ -v "${PIHOLE_BASE}/etc-dnsmasq.d:/etc/dnsmasq.d:U,z" \ --dns=127.0.0.1 --dns=1.1.1.1 \ --restart=unless-stopped \ --hostname pi.hole \ -e VIRTUAL_HOST="pi.hole" \ -e PROXY_LOCATION="pi.hole" \ -e ServerIP="10.0.0.1" \ -e INTERFACE="tap0" \ -e WEBPASSWORD="xxxxxxxxxx" \ pihole/pihole:latest