PiHole
PiHole
Information
This is behind a separate profile. Configure this on your network with caution. This could block things unnecessarily, but can be very useful to block ads without needing an extension to do so.
- For more information, please refer to the PiHole Docs
- Just pihole Commands
Type | Command |
---|---|
Start | docker compose up pihole -d |
Shutdown | docker compose down pihole |

- Once started, pihole should be hit from this url:
URL | |
---|---|
Non-SSL (Web UI) | http://localhost:8880/admin |
Image | pihole/pihole(Docker Hub) |
PiHole Example Docker Compose
services:
pihole:
container_name: ${PIHOLE_CONTAINER_NAME}
image: pihole/pihole:latest
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
- "${PIHOLE_HOST_PORT}:80/tcp" # Web interface -- http://<ipaddress>:${PIHOLE_HOST_PORT}/admin
env_file:
- ./.env
- ../../.env
environment:
TZ: ${TIMEZONE}
WEBPASSWORD: ${PIHOLE_SECURE_WEB_PASSWORD}
labels:
- "traefik.enable=true"
- "traefik.http.routers.${PIHOLE_CONTAINER_NAME}.rule=Host(`${PIHOLE_CONTAINER_NAME}.${PROJECT_HOSTNAME}`)"
- "traefik.http.routers.${PIHOLE_CONTAINER_NAME}.entrypoints=https"
- "traefik.http.routers.${PIHOLE_CONTAINER_NAME}.tls=true"
- "traefik.http.middlewares.${PIHOLE_CONTAINER_NAME}.addprefix.prefix=/admin"
- "traefik.http.services.${PIHOLE_CONTAINER_NAME}.loadbalancer.server.port=80"
# Volumes store your data between container upgrades
volumes:
- "${DEFAULT_CONTAINER_DATA_LOCATION}/PiHole/config:/etc/pihole"
- "${DEFAULT_CONTAINER_DATA_LOCATION}/PiHole/etc-dnsmasq.d:/etc/dnsmasq.d"
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
cap_add:
- NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
restart: unless-stopped
networks:
homelab:
pihole_network:
ipv4_address: "${PIHOLE_STATIC_IP_ADDRESS}" #update, assign open ip manually
profiles:
- all
- pihole
PiHole Example .env
file
## PIHOLE
PIHOLE_HOST_PORT="8880"
PIHOLE_CONTAINER_NAME="pihole"
PIHOLE_SECURE_WEB_PASSWORD="pihole"
PIHOLE_STATIC_IP_ADDRESS="192.168.1.200"