blob: de9409a748ff0a8972d5b8abd55e315d180ab827 [file] [log] [blame]
giolekva2e443222020-06-25 18:46:46 +04001#!/bin/bash
2
3# https://github.com/pi-hole/docker-pi-hole/blob/master/README.md
4
5# Note: ServerIP should be replaced with your external ip.
6docker run -d \
7 --name pihole \
8 -p 53:53/tcp -p 53:53/udp \
9 -p 80:80 \
10 -p 443:443 \
11 -e TZ="America/Chicago" \
12 -v "$(pwd)/etc-pihole/:/etc/pihole/" \
13 -v "$(pwd)/etc-dnsmasq.d/:/etc/dnsmasq.d/" \
14 --restart=unless-stopped \
15 --hostname pi.hole \
16 -e VIRTUAL_HOST="pi.hole" \
17 -e PROXY_LOCATION="pi.hole" \
18 -e ServerIP="127.0.0.1" \
19 pihole/pihole:latest
20
21# --dns=127.0.0.1 --dns=1.1.1.1 \
22
23printf 'Starting up pihole container '
24for i in $(seq 1 20); do
25 if [ "$(docker inspect -f "{{.State.Health.Status}}" pihole)" == "healthy" ] ; then
26 printf ' OK'
27 echo -e "\n$(docker logs pihole 2> /dev/null | grep 'password:') for your pi-hole: https://${IP}/admin/"
28 exit 0
29 else
30 sleep 3
31 printf '.'
32 fi
33
34 if [ $i -eq 20 ] ; then
35 echo -e "\nTimed out waiting for Pi-hole start, consult check your container logs for more info (\`docker logs pihole\`)"
36 exit 1
37 fi
38done;