
In this example, we will install Pi-hole Docker on a DietPi. We will leverage features such as secrets, file distribution with templating, and post-command.
Pi-hole can be installed in several ways, but the easiest one is to use the Docker image provided by the Pi-hole team. The image can be found on GitHub: Pi-hole Docker GitHub.
version: "3"
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
pihole:
container_name: pihole
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
- "80:80/tcp"
environment:
TZ: 'America/Chicago'
WEBPASSWORD: '{{PIHOLE_WEBPASSWORD}}'
# Volumes store your data between container upgrades
volumes:
- './etc-pihole:/etc/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-stoppedLet's set the actual value for the PIHOLE_WEBPASSWORD parameter.
Open the file manager and upload the file
All preparations are complete. Let's proceed with File Distribution:
cd /home/dietpi/docker
docker-compose up -dNow, patiently wait for approximately 5 minutes for the next agent run. Once completed, you can review the logs to ensure that everything has been successfully set up.
Click on the "report" icon within the top line to view the entire console output. Look for the last line indicating "Container pihole Started."
You now can configure your router to use the Pi-hole as DNS server. This will allow you to block ads on all devices in your network. Also, check out our tutorial on how to install qbee-agent on OpenWrt
Unlock more control over your Pi-hole installation by exposing additional parameters in the compose.yml file (see: Pi-hole Docker GitHub).
On this example we applied the configuration to a single device, but qbee.io allows you to manage thousands of devices in a simple and efficient way. Apply common or different configurations for groups of devices, and manage them from a single UI.
