Skip to content

Instantly share code, notes, and snippets.

View Zerrtified's full-sized avatar

Steve Zerr Zerrtified

View GitHub Profile
@Zerrtified
Zerrtified / resolver.sh
Created January 10, 2026 23:56 — forked from tomazzaman/resolver.sh
Automatically add hostnames to Pihole whenever containers get updated
#!/bin/sh
#
# Update Pihole's custom.list based on the "hostname" property of a container.
#
# Environment variables
# - OVERRIDE_IP sets the IP of the container in Pihole's DNS records. Defaults to container IP in Docker network.
# - DOMAIN_FILTER only triggers the updates on a match. If empty, it'll always update the records file.
# - PIHOLE_CUSTOM_LIST_FILE /etc/hosts compatible DNS records file in format "IP hostname".
# - PIHOLE_CONTAINER_NAME because we need to reload Pihole's internal resolver when making changes
#