Last active
January 19, 2021 05:42
-
-
Save turnipsoup/6f0d7cd60c37e3819f41f443f13b9ef1 to your computer and use it in GitHub Desktop.
Script and YAML file for stopping, updating, and restarting my docker Pihole installation
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: <super-secret-pass> | |
# 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 /usr/local/docker/pihole.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