Facilitate Pi-hole DNS entry automation for Docker services efficiently with docker-pihole-customdns. Simplify the management process, ensuring seamless integration and reduced manual effort.
Perfect for use when running your services behind a proxy such as Traefik or nginx. Instead of manually adding and removing DNS entries for your self-hosted Docker applications in Pi-hole, specify the domain to use in a label on your container and let Docker Pi-hole Custom DNS create the DNS entry for you.
- DNS A record management
- DNS CNAME record management
- Up to two Pi-hole DNS servers
docker pull download.noyes.uk/davidnoyes/docker-pihole-customdns:latest
(Images hosted by ghcr.io with a custom domain)
OS / Arch
- linux/amd64
- linux/arm/v7
- linux/arm64
docker run --name docker-pihole-customdns -d --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock:ro -e DPC_PIHOLE_URL=http://pi.hole -e DPC_DEFAULT_TARGET_IP=198.51.100.0 -e DPC_PIHOLE_API_TOKEN=abcdefghijklmnopqrstuvwxyz
Replace the values for DPC_PIHOLE_URL
, DPC_DEFAULT_TARGET_IP
& DPC_PIHOLE_API_TOKEN
as appropriate
The conatiner label to be applied to service containers is:
docker-pihole-customdns.domain=
It can be applied in the following way:
docker run -d --name nginx -l docker-pihole-customdns.domain=my-service.int.my-domain.net nginx
version: "3.8"
services:
docker-pihole-customdns:
container_name: docker-pihole-customdns
image: download.noyes.uk/davidnoyes/docker-pihole-customdns:latest
restart: unless-stopped
security_opt:
- no-new-privileges:true
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- DPC_PIHOLE_API_TOKEN=abcdefghijklmnopqrstuvwxyz
- DPC_DEFAULT_TARGET_IP=198.51.100.0
- DPC_PIHOLE_URL=http://pi.hole
Variable | Description |
---|---|
DPC_PIHOLE_API_TOKEN |
Pi-hole API Token. |
DPC_PIHOLE_API_TOKEN_2 |
Second Pi-hole API Token (Optional) |
DPC_DEFAULT_TARGET_IP |
Default target IP address for the Docker host. The IP address used by the http proxy for all docker services on the host. |
DPC_DEFAULT_TARGET_DOMAIN |
Default target domain address for the Docker host. The DNS address used by the http proxy for all docker services on the host. |
DPC_PIHOLE_URL |
Pi-hole URL (e.g. http://pi-hole) |
DPC_PIHOLE_URL_2 |
Second Pi-hole URL (optional) |
Usage of ./docker-pihole-customdns:
-apitoken string
Pi-hole API token
-apitoken2 string
Second Pi-hole API token (Optional)
-piholeurl string
Pi-hole URL (e.g. http://pi.hole)
-piholeurl2 string
Second Pi-hole URL (Optional e.g. http://pi.hole)
-targetdomain string
Default target domain address for the Docker host
-targetip string
Default target IP address for the Docker host
Pi-hole API token can be obtained here: http://pi.hole/admin/settings.php?tab=api
(Where pi.hole
will resolve to your Pi-hole instance or replace with your own domain/IP address.)