mirror of
https://github.com/nickyeoman/docker-compose-cookbooks.git
synced 2026-09-03 18:36:22 +00:00
Updated pihole
This commit is contained in:
@@ -0,0 +1,49 @@
|
|||||||
|
# PiHole
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
This Docker Compose project deploys a Pi-hole DNS sinkhole and network-wide ad blocker. It centralizes DNS filtering, logging, and management behind a lightweight containerized service.
|
||||||
|
|
||||||
|
## Project Details
|
||||||
|
|
||||||
|
- **Project Repository:** [Link](https://pi-hole.net/)
|
||||||
|
- **Container Image:** [Docker Hub](https://hub.docker.com/r/pihole/pihole)
|
||||||
|
- **Compose Example:** [Compose](https://hub.docker.com/r/pihole/pihole)
|
||||||
|
- **Documentation:** [Docs](https://docs.docker.com/compose/install/)
|
||||||
|
- **Reverse Proxy Port:** `53 (tcp & udp), 80, 443, 67, 123`
|
||||||
|
|
||||||
|
## Environment Variable Notes
|
||||||
|
|
||||||
|
Below are the key environment variables commonly used with the Pi-hole container.
|
||||||
|
You can also read more here: https://hub.docker.com/r/pihole/pihole
|
||||||
|
|
||||||
|
```
|
||||||
|
TZ – Your timezone (e.g., "America/Toronto"). Used for correct log timestamps.
|
||||||
|
WEBPASSWORD – Password for the Pi-hole admin web interface. If omitted, a random one is generated.
|
||||||
|
DNSMASQ_LISTENING – Set to "all" to allow queries from the LAN.
|
||||||
|
ServerIP – The host machine’s LAN IP address. Required so Pi-hole can properly generate block pages.
|
||||||
|
FTLCONF_LOCAL_IPV4 – Alternative to ServerIP for newer versions; defines Pi-hole’s listening IP.
|
||||||
|
INTERFACE – Network interface Pi-hole should bind to (e.g., eth0). Optional if using host networking.
|
||||||
|
VIRTUAL_HOST – (Optional) Used with reverse proxies for URL routing.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Volume Notes
|
||||||
|
|
||||||
|
Pi-hole uses volumes to persist configuration and query data:
|
||||||
|
|
||||||
|
```
|
||||||
|
/etc/pihole – Stores Pi-hole configs, gravity lists, custom blocklists, DHCP settings, logs.
|
||||||
|
/etc/dnsmasq.d – Stores dnsmasq configuration files used by Pi-hole’s DNS service.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional Notes / Gotchas
|
||||||
|
|
||||||
|
DHCP Server: If running Pi-hole as your network DHCP server, the container must run in host networking mode to broadcast DHCP packets correctly.
|
||||||
|
|
||||||
|
Networking: Pi-hole works best in host networking mode. If using bridge mode, you must set ServerIP and ensure port 53 (TCP/UDP) is exposed.
|
||||||
|
|
||||||
|
Port Conflicts: Nothing else on the host may use port 53. Disable systemd-resolved or any local DNS server if necessary.
|
||||||
|
|
||||||
|
Docker + Reverse Proxy: Pi-hole doesn’t always play nicely behind reverse proxies. If using one, forward only the admin interface (port 80) and keep DNS ports (53) exposed directly.
|
||||||
|
|
||||||
|
Gravity Updates: Pi-hole updates blocklists daily. If using custom lists, verify they can be fetched without authentication or special headers.
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
services:
|
||||||
|
pihole:
|
||||||
|
image: ${PIHOLE_IMAGE:-pihole/pihole:latest}
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- './etc-pihole:/etc/pihole'
|
||||||
|
- './etc-dnsmasq:/etc/dnsmasq.d'
|
||||||
|
environment:
|
||||||
|
- TZ=${TZ:-America/Vancouver}
|
||||||
|
# Set a password to access the web interface. Not setting one will result in a random password being assigned
|
||||||
|
- FTLCONF_webserver_api_password=${PIHOLE_PASSWORD:-correctHorseBatteryStaple}
|
||||||
|
# If using Docker's default `bridge` network setting the dns listening mode should be set to 'ALL'
|
||||||
|
- FTLCONF_dns_listeningMode=${PIHOLE_LISTENMODE:-ALL}
|
||||||
|
ports:
|
||||||
|
# DNS Ports
|
||||||
|
- "53:53/tcp"
|
||||||
|
- "53:53/udp"
|
||||||
|
# Default HTTP Port
|
||||||
|
- "80:80/tcp"
|
||||||
|
# Default HTTPs Port. FTL will generate a self-signed certificate
|
||||||
|
- "443:443/tcp"
|
||||||
|
# Uncomment the line below if you are using Pi-hole as your DHCP server
|
||||||
|
#- "67:67/udp"
|
||||||
|
# Uncomment the line below if you are using Pi-hole as your NTP server
|
||||||
|
#- "123:123/udp"
|
||||||
|
cap_add:
|
||||||
|
# See https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
|
||||||
|
# Required if you are using Pi-hole as your DHCP server, else not needed
|
||||||
|
# - NET_ADMIN
|
||||||
|
# Required if you are using Pi-hole as your NTP client to be able to set the host's system time
|
||||||
|
- SYS_TIME
|
||||||
|
# Optional, if Pi-hole should get some more processing time
|
||||||
|
- SYS_NICE
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
TZ="America/Vancouver"
|
||||||
|
PIHOLE_IMAGE="pihole/pihole:latest"
|
||||||
|
PIHOLE_PASSWORD="correctHorseBatteryStaple"
|
||||||
|
PIHOLE_LISTENMODE="ALL"
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
# PiHole
|
|
||||||
|
|
||||||
[official website](https://pi-hole.net/)
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
services:
|
|
||||||
pihole:
|
|
||||||
image: pihole/pihole:latest
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "53:53/tcp" # DNS
|
|
||||||
- "53:53/udp" # DNS
|
|
||||||
- "80:80/tcp" # Web interface
|
|
||||||
environment:
|
|
||||||
TZ: "America/Vancouver" # Set your timezone
|
|
||||||
WEBPASSWORD: "your_secure_password"
|
|
||||||
DNS1: "1.1.1.1" # Upstream DNS (Cloudflare)
|
|
||||||
DNS2: "1.0.0.1"
|
|
||||||
VIRTUAL_HOST: "pihole.yourdomain.com" # Set your domain if applicable
|
|
||||||
ServerIP: "your_server_ip" # Set your server's IP address
|
|
||||||
volumes:
|
|
||||||
- './etc-pihole:/etc/pihole'
|
|
||||||
- './etc-dnsmasq:/etc/dnsmasq.d'
|
|
||||||
cap_add:
|
|
||||||
- NET_ADMIN
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
VOL_PATH=./data
|
|
||||||
TZ="America/Vancouver"
|
|
||||||
COMPOSE_PROJECT_NAME=pihole
|
|
||||||
Reference in New Issue
Block a user