Synchronise records found through docker labels with pihole's custom dns and cname records.
10.0K
Synchronise records founds through docker labels with pihole's custom dns and cname records.
You can find the project on GitHub
Show API token buttonRaw API TokenPIHOLE_TOKENcli
docker run \
-l "pihole.custom-record=[[\"pihole-dns-shim.lan\", \"127.0.0.1\"]]" \
-e PIHOLE_TOKEN="" \
-e PIHOLE_API="http://pi.hole:8080/admin/api.php" \
-e STATE_FILE="/state/pihole.state" \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
theonlysinjin/docker-pihole-dns-shim
docker-compose.yml
services:
pihole-dns-shim:
container_name: "pihole-dns-shim"
image: theonlysinjin/docker-pihole-dns-shim
restart: unless-stopped
labels:
- pihole.custom-record=[["pihole-dns-shim.lan", "127.0.0.1"]]
environment:
PIHOLE_TOKEN: "${PIHOLE_TOKEN}"
PIHOLE_API: "${PIHOLE_API}"
# LOGGING_LEVEL: "DEBUG"
# STATE_FILE: "/state/pihole.state"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
Add records to pihole by labelling your docker containers, you can add as many labels(records) to individual containers as you need.
An example of the (json-encoded) label is as follows:
pihole.custom-record:
- ["pihole-dns-shim.lan", "127.0.0.1"]
- ["pihole-dns-shim.lan", "www.google.com"]
as a docker label:
"pihole.custom-record=[[\"pihole-dns-shim.lan\", \"127.0.0.1\"], [\"pihole-dns-shim.lan\", \"www.google.com\"]]"
You can turn on extra logging by setting the log level to DEBUG,
Set an env variable in the container with LOGGING_LEVEL="DEBUG"
Content type
Image
Digest
sha256:0caf89564…
Size
29.4 MB
Last updated
6 months ago
docker pull theonlysinjin/docker-pihole-dns-shim