add notes on labels setup for nginx/pihole sautomation
All checks were successful
deploy-docs / build-and-deploy (push) Successful in 1m32s

This commit is contained in:
2026-04-28 01:45:38 +00:00
parent ecbce9847f
commit 4379fb2d9a
2 changed files with 53 additions and 1 deletions

View File

@@ -14,11 +14,37 @@ without installing any client-side software. Useful for blocking ad services at
a DNS level. It uses a list of known ad services stored on github, can add your
own. It can also operate as a internal dns router and dhcp server.
## Automation (Docker Labels)
To automate adding Custom DNS entries to Pi-hole when creating new Docker containers, I use the `docker-pihole-dns-shim` sidecar. This prevents the need to manually update Pi-hole's DNS records every time a new service is deployed.
### Docker Compose Example (The Shim)
The shim runs alongside your other management containers and watches the Docker socket. **Note:** Use the direct IP address of your Pi-hole (e.g., `10.0.0.11`) to ensure the container can reach the API.
```yaml
{{% include "/srv/configs/docker_compose/pihole-external-dns/docker-compose.yaml" %}}
```
### How to Auto-Configure a Service
To create a DNS record in Pi-hole for a new container, add the following label to its `docker-compose.yaml`. The shim will automatically detect this and call the Pi-hole API.
```yaml
services:
my-app:
image: my-app:latest
labels:
# Format: [["domain", "IP_Address"]]
- "pihole.custom-record=[[\"myapp.wompmacho.com\", \"10.0.0.190\"]]"
```
> [!important] Reverse Proxies
> When using a reverse proxy like Nginx Proxy Manager, you should point the Pi-hole DNS record to the **IP of the Docker host/Proxy** (e.g., `10.0.0.190`), *not* the internal Docker IP of the individual container.
## Pihole Setup
If you have a raspberry-pi or another device, its super easy to get things
going.
...
- [pihole setup](https://github.com/pi-hole/pi-hole/?tab=readme-ov-file#one-step-automated-install).
Any debian based system should be able to get things going quickly. Then all you