Skip to content

Instantly share code, notes, and snippets.

@dnburgess
Last active October 14, 2023 21:29
Show Gist options
  • Save dnburgess/5caf8ff10f65bdc2467d532f55753774 to your computer and use it in GitHub Desktop.
Save dnburgess/5caf8ff10f65bdc2467d532f55753774 to your computer and use it in GitHub Desktop.
DB Tech Pi-hole on Pi 4
---
version: 2
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- 53:53/tcp #DNS Port
- 53:53/udp #DNS Port
#- 67:67/udp #DHCP Port
- 83:80/tcp #Dashboard Port
#- 443:443/tcp #Port 443 is to provide a sinkhole for ads that use SSL.
environment:
TZ: America/Denver
WEBPASSWORD: password
DNS1: 1.1.1.1
DNS2: 1.0.0.1
DNSSEC: 'true'
volumes:
- /srv/dev-disk-by-label-Files/Config/Pihole/etc-pihole/:/etc/pihole/
- /srv/dev-disk-by-label-Files/Config/Pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/
cap_add:
- NET_ADMIN
restart: unless-stopped
This won't work out of the box as Raspbian has port 53 being used. We need to stop and reconfigure the service using it.
To stop systemd-resolved, run this command:
sudo systemctl stop systemd-resolved
To edit systemd-resolved, run this command:
sudo nano /etc/systemd/resolved.conf
Edit the file so it looks like this:
[Resolve]
DNS=1.1.1.1
FallbackDNS=1.0.0.1
#Domains=
#LLMNR=yes
#MulticastDNS=yes
#DNSSEC=allow-downgrade
#DNSOverTLS=no
#Cache=yes
#DNSStubListener=yes
#ReadEtcHosts=yes
DNSStubListener=no
Save and exit.
To create a symlink of the changes you made, run this command:
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
@PracticalChip
Copy link

Updated version.

version: "3"

pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
#- "67:67/udp"
- "83:80/tcp"
environment:
TZ: 'America/Chicago'
# WEBPASSWORD: 'password'
# Volumes store your data between container upgrades
volumes:
- /srv/dev-disk-by-label-Files/Config/Pihole/etc-pihole/:/etc/pihole/
- /srv/dev-disk-by-label-Files/Config/Pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/
cap_add:
- NET_ADMIN
restart: unless-stopped

Copy link

ghost commented May 19, 2021

Hi, Looks like your updated version doesn't work. I get YAML marshaling error. Not an expert with YAML (rookie here :-) ), but could it be the layout that is too flat compared to your v2 of the YAML script ?

thnx
Ralph

@PracticalChip
Copy link

Hi, Looks like your updated version doesn't work. I get YAML marshaling error. Not an expert with YAML (rookie here :-) ), but could it be the layout that is too flat compared to your v2 of the YAML script ?

thnx
Ralph

I just copied and pasted, you can go ahead and format it correctly if you want, I dont think I have it anymore as I went for a pihole+unbound container.

Copy link

ghost commented May 20, 2021 via email

@NeoHuncho
Copy link

For anyone looking, here is a revised and fixed version 3:

version: "3"

services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
- "83:80/tcp"
environment:
TZ: 'America/Chicago'
# WEBPASSWORD: 'password'
volumes:
- /srv/dev-disk-by-label-Files/Config/Pihole/etc-pihole/:/etc/pihole/
- /srv/dev-disk-by-label-Files/Config/Pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/
cap_add:
- NET_ADMIN
restart: unless-stopped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment