Docker container installation
Installation Methods
Deploying Pi-hole with Docker extends beyond typical Raspberry Pi usage, but it’s entirely possible. If you have an existing server and want to set up a Pi-hole instance quickly, Docker makes it straightforward.
Using Docker offers several advantages: it simplifies installation by reducing manual setup, enhances portability by enabling deployment on various platforms beyond the Raspberry Pi, and ensures isolation, minimising conflicts with other services. Additionally, updating Pi-hole becomes as easy as pulling a new Docker image and restarting the container. If you already run Docker containers, adding Pi-hole requires minimal additional system resources.
Pi-hole can be deployed with minimal configuration using Docker. Here’s a basic setup using docker-compose:
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
- "80:80/tcp"
environment:
TZ: 'America/Chicago'
# WEBPASSWORD: 'set-a-secure-password'
volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
restart: unless-stopped
For persistent storage, the configuration files are mapped to local volumes. After saving as docker-compose.yml, run:
docker compose up -d
Key considerations:
- Set a secure password via WEBPASSWORD environment variable
- Ensure port 53 is available (may require disabling local DNS services)
- Use
--net=hostinstead of port mapping if planning to use DHCP - Access the web interface at
http://pi.hole/adminpost-installation
The container automatically restarts unless explicitly stopped, maintaining continuous ad-blocking service across system reboots.
Something here not working for you? Ask in the community — other makers and the Little Bird team read it.