The official Pi-hole Docker image from pi-hole.net with an Unbound DNS resolver pre-configured in it
10K+

This Docker deployment runs both Pi-Hole and Unbound in a single container.
The base image for the container is the official Pi-Hole container, with an extra build step added to install the Unbound resolver directly into it based on instructions provided directly by the Pi-Hole team.
The Github repository is set to automatically check for a new PiHole version every day by monitoring the official Pi-Hole docker repository. If a new release is detected, a new image is automatically generated and pushed to dockerhub repository and GitHub Container Registry.
This configuration contacts the DNS root servers directly, please read the Pi-Hole docs on Pi-hole as All-Around DNS Solution to understand what this means.
Caution
Updating from tag version <= 2024.x.x to >= 2025.x.x
Pi-hole v6 has been entirely redesigned from the ground up and contains many breaking changes.
Environment variable names have changed, script locations may have changed.
If you are using volumes to persist your configuration, be careful.
Replacing anyv5image (2024.07.0and earlier) with av6image will result in updated configuration files. These changes are irreversible.Please refer to this guide:
Download the pre-made docker-compose.yml that you can also find in this repository...
curl -SO https://raw.githubusercontent.com/nyirsh/pihole-unbound/main/docker-compose.yml
Please keep in mind that this is a very quick and dirty way to kickstart your instance, it is highly recommended that you customize the docker-compose.yml to properly match your environment requirements. If this sentence doesn't make much sense to you, I would highly recommend learning more about docker.
Create a .env file in the same folder where docker-compose.yml is and substitute the values to match what's required for your deployment:
HOSTNAME=pihole
DOMAINNAME=pihole.local
LOCAL_IPV4=192.168.1.10
PIHOLE_WEBPORT_HTTP=80
PIHOLE_WEBPORT_HTTPS=443
TZ=America/Los_Angeles
WEBPASSWORD=YourAdminPassword
WEBTHEME=default-dark
REV_SERVER=true
REV_SERVER_DOMAIN=local
REV_SERVER_TARGET=192.168.1.1
REV_SERVER_CIDR=192.168.0.0/16
| Variable | Default | Value | Description |
|---|---|---|---|
HOSTNAME | pihole | Container host name | Set to your preferred docker container hostname for the Pi-Hole instance |
DOMAINNAME | pihole.local | Container domain name | Set to your preferred docker container domainname for the Pi-Hole instance |
LOCAL_IPV4 | Ip address | Ip address of the machine running Pihole, not 127.0.0.1! | |
PIHOLE_WEBPORT_HTTP | 80 | Exposed HTTP Port | Set this to the port you want to use to access Pi-Hole via HTTP. Make sure the port isn't already in use! |
PIHOLE_WEBPORT_HTTPS | 443 | Exposed HTTPS Port | Set this to the port you want to use to access Pi-Hole via HTTPS. Make sure the port isn't already in use! |
For a complete list of possible variables, please refer to the Pi-Hole official documentation:
docker-compose up -d
Tip
If using Portainer, just paste the `docker-compose.yml` contents into the stack config and add your _environment variables_ directly in the UI.
- Q: I also want to use Cloudflare or change some other parameters of Pi-Hole!
Please keep in mind that the docker-compose.yml and .env files provided in this repository are just an example! Feel free to customize the files so that they can match your expected experience, if you're unsure on how to do so I would highly recommend getting some knowledge on Docker first.
- Q: I am running Pi-Hole alongside other containers on the same machine but, despite setting the DNS to match the host machine IP, I still can't resolve any address!
Yep, it's a docker limitation of some sort, you can find more details here. To keep it short, change these two ports in your docker-compose.yml file:
- "${LOCAL_IPV4}:53:53/tcp"
- "${LOCAL_IPV4}:53:53/udp"
- Q: Thank you for this! Do you accept donations?
A: No I do not, I really did nothing special and everything here is fully automated so I don't think I deserve any kind of donation or recognition. If you're really willing to donate some money please consider giving them to the Pi-Hole itself.
- Q: I updated to a version 2025.x.x from a 2024.x.x and nothing works anymore
Yep, this is not my fault. The pihole team redesigned the entire application and changed names of a lot of variables. Please refer to this guide.
- Q: Why doesn't it work on my system?
I don't know, but maybe you can find more details here.
Thanks to Chris Crowe for figuring the original (pihole version <= 2024.x.x) installation method out and inspiring this project.
Content type
Image
Digest
sha256:3a51de524…
Size
506 Bytes
Last updated
about 12 hours ago
docker pull nyirsh/pihole-unbound:sha256-8977362b37b28b7794a26413bbbeb206f24d8927b44a38ddd90f758ba6cd5e87.sig