From 9a509faecec3cc7aa9ac7e2481a0dd2a1ad2fcf7 Mon Sep 17 00:00:00 2001 From: dechert Date: Sat, 29 May 2021 13:28:00 +0200 Subject: [PATCH] docker files --- README.md | 14 +++++++++++++- docker-compose.yml | 24 ++++++++++++++++++++++++ docker_run.sh | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yml create mode 100644 docker_run.sh diff --git a/README.md b/README.md index be3635b..0bab305 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,14 @@ -# pi-hole-server + + +https://hub.docker.com/r/pihole/pihole + +https://github.com/pi-hole/docker-pi-hole/blob/master/docker_run.sh + + +For starters: DNS Settings changed to Pi hole for each device +Pi Hole als DNS server im Router eintragen + +youtube ad blocking + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7d0b08d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: "3" + +# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/ +services: + pihole: + container_name: pihole + image: pihole/pihole:latest + ports: + - "53:53/tcp" + - "53:53/udp" + - "67:67/udp" + - "80:80/tcp" + environment: + TZ: 'America/Chicago' + # WEBPASSWORD: 'set a secure password here or it will be random' + # Volumes store your data between container upgrades + volumes: + - './etc-pihole/:/etc/pihole/' + - './etc-dnsmasq.d/:/etc/dnsmasq.d/' + # Recommended but not required (DHCP needs NET_ADMIN) + # https://github.com/pi-hole/docker-pi-hole#note-on-capabilities + cap_add: + - NET_ADMIN + restart: unless-stopped \ No newline at end of file diff --git a/docker_run.sh b/docker_run.sh new file mode 100644 index 0000000..f95f40a --- /dev/null +++ b/docker_run.sh @@ -0,0 +1,39 @@ +#!/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; } + +# Note: ServerIP should be replaced with your external ip. +docker run -d \ + --name pihole \ + -p 53:53/tcp -p 53:53/udp \ + -p 80:80 \ + -e TZ="America/Chicago" \ + -v "${PIHOLE_BASE}/etc-pihole/:/etc/pihole/" \ + -v "${PIHOLE_BASE}/etc-dnsmasq.d/:/etc/dnsmasq.d/" \ + --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="127.0.0.1" \ + pihole/pihole:latest + +printf 'Starting up pihole container ' +for i in $(seq 1 20); do + if [ "$(docker inspect -f "{{.State.Health.Status}}" pihole)" == "healthy" ] ; then + printf ' OK' + echo -e "\n$(docker logs pihole 2> /dev/null | grep 'password:') for your pi-hole: https://${IP}/admin/" + exit 0 + else + sleep 3 + printf '.' + fi + + if [ $i -eq 20 ] ; then + echo -e "\nTimed out waiting for Pi-hole start, consult your container logs for more info (\`docker logs pihole\`)" + exit 1 + fi +done;