My setup for running Pi-Hole on a Synology NAS using Docker Compose.
This includes a custom notifier application, which runs in a separate container, that sends an email alert when there is a DNS lookup block from the upstream DNS server. I use this along with Cloudflare's 1.1.1.3 DNS service so that I get notifications for DNS lookups for malware and adult content sites.
Clone this repo on the NAS.
The docker-compose.yaml file has several network-specific settings that need to be correct, and those are commented as such in the file. You'll also need to map volumes to existing directories on the NAS so that Pi-Hole's configuration and data are persistent, and so that the notifier application can detect upstream blocks by reading Pi-Hole's database.
For the notifier, settings use Docker secrets. Create a secrets
directory on
the NAS in the same directory as this README.md file with a notifier_config.json
file something like this:
{
"SMTP_HOST": "smtp.gmail.com",
"SMTP_USERNAME": "my@gmail.com",
"SMTP_PASSWORD": "my password here",
"FTL_DB_FILE": "/etc/pihole/pihole-FTL.db",
"MAIL_SENDER": "my@gmail.com",
"MAIL_RECIPIENTS": "me@somewhere.com"
}
For Pi-Hole itself, the compose file references secrets/pihole.env, so you can create that file and put the WEBPASSWORD environment variable in there.
WEBPASSWORD=MyPiHoleWebPassword
- ssh to the NAS using the admin account.
- switch to root with
sudo -i
- change to the directory containing this repo.
docker-compose pull
docker-compose build
docker-compose up --detach