Last active
February 12, 2021 19:47
-
-
Save turnipsoup/68016e02686feb907d93be7562015620 to your computer and use it in GitHub Desktop.
Script for running and updating a Pihole docker container. You use the same script the first time you start it up as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
- "9080:80/tcp" | |
- "9443:443/tcp" | |
environment: | |
TZ: 'America/Los_Angeles' | |
WEBPASSWORD: 'Pihole!' | |
# Volumes store your data between container upgrades | |
volumes: | |
- './etc-pihole/:/etc/pihole/' | |
- './etc-dnsmasq.d/:/etc/dnsmasq.d/' | |
dns: | |
- 127.0.0.1 | |
- 1.1.1.1 | |
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
DOCKERID=$(docker container ls | grep pihole | awk '{print $1}') | |
# Stop the container | |
echo "Stopping container with ID $DOCKERID" | |
docker container stop $DOCKERID | |
# Update the image | |
echo "Updating the Pihole image" | |
docker pull pihole/pihole:latest | |
# Start the container | |
docker-compose -f ./pihole-docker-compose.yaml up -d | |
echo "You can view the status of the containers: sudo docker container ls" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment