Installing Pihole with Docker on Synology NAS DSM6

or “start your pi-hole”
  1. Using Cloudflare for DDNS with LetsEncrypt for TLS Certs — medium story
  2. Configured macvlan networking for Docker — medium story

Other Hot-takes

  1. Started here — anything Scott can do, I can probably do in time x 3, and less well: https://scotthelme.co.uk/securing-dns-across-all-of-my-devices-with-pihole-dns-over-https-1-1-1-1/
  2. This Docker script was hugely helpful — https://gist.github.com/xirixiz/ecad37bac9a07c2a1204ab4f9a17db3c
  3. Docker-compose .env files made my service repeatable (and pretty) https://stackoverflow.com/questions/36283908/re-using-environmental-variables-in-docker-compose-yml
  4. Tony Lawrence’s blog was my starter-for-ten http://tonylawrence.com/posts/unix/synology/running-pihole-inside-docker/
  5. This thread on pi-hole cleared up a few blurry bits (especially around networking) https://discourse.pi-hole.net/t/setup-on-synology-docker/18067/2

Basics

Docker-Compose

docker-compose index
echo "alias piup='sudo docker-compose up -d pihole'" >> ~/.bashrc

.env (Docker environment vars)

Pihole Service Config

pihole docker-compose file
  1. /etc/localtime to keep time in sync
  2. pihole-configs for my pihole configs
  3. dnsmasq.d for my dnsmasq.d config
  4. external.conf is my https configuration for the pihole web interface #OPTIONAL (see below)
  5. $(CERTHOME) maps my LetsEncrypt cert directory into pihole so I can add it into external.conf (above)

Configuring the HTTPS Interface

$ sudo cat /usr/local/share/acme.sh/${DOMAINNAME}/${DOMAINNAME}.key \
/usr/local/share/acme.sh/${DOMAINNAME}/${DOMAINNAME}.cer | \
sudo tee /usr/local/share/acme.sh/${DOMAINNAME}/${DOMAINNAME}.combined.pem

Spinning it up

Updating Gravity

#!/bin/bash
docker exec pihole pihole updateGravity

--

--

--

Is this bio too short? Or is it just the right length?

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Concealed Public Cloud Costs and How to Avoid Them

Testing in Agile World

Agile Project Management: Best Practices and Methodologies

Implicit none and carry on

Run Crash Simulations on SyncHPC: Radioss

The DevTools that Changed my Life

Introducing G|Code’s Change Makers: Mariamawit Loulseged

CS371g Summer 2020: Abu-Zayd Abdullah

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
corcoran

corcoran

Is this bio too short? Or is it just the right length?

More from Medium

Evaluating Docker Desktop 4.6’s new VirtioFS file sync on macOS

VirtioFS accelerated directory sharing in Docker Desktop 4.6

Enabling SSL on PostgreSQL

Setup Apache Hadoop on local Ubuntu System

Indefinitely Long-Lived AWS Sessions Using aws-vault and docker-compose: The Guide I Wish I’d Had