codex
Search…
Adblocking

Pi-hole

Pi-hole is a DNS-based adblocker for your network. Think of it as /etc/hosts on steriods. no, you can't block youtube ads

Personal Blocklists

I maintain a list of the blocklists I use, here

Pi-hole on Docker

Here's a docker-compose containg the useful info to spawn a pi-hole container.
Important: this is a generic pi-hole installation, with some personal preferences. DNS points to the malware-blocking Cloudflare resolver, but I can also highly recommend Quad9.
1
version: "3.3"
2
3
services:
4
pihole:
5
container_name: pihole
6
image: pihole/pihole:latest
7
hostname: pihole
8
ports:
9
- "53:53/tcp"
10
- "53:53/udp"
11
- "80:80/tcp"
12
environment:
13
TZ: "Europe/London"
14
WEBPASSWORD: "<web-password>"
15
ServerIP: "<ip-address>"
16
PIHOLE_DNS_: "1.1.1.2;1.0.0.2"
17
DNSSEC: "true"
18
BLOCK_ICLOUD_PR: "true"
19
WEBUIBOXEDLAYOUT: "traditional"
20
WEBTHEME: "default-dark"
21
REV_SERVER: "true"
22
REV_SERVER_TARGET: "<gateway-ip>"
23
REV_SERVER_CIDR: "<ip-cidr>/24"
24
volumes:
25
- "./etc-pihole/:/etc/pihole/"
26
- "./etc-dnsmasq.d/:/etc/dnsmasq.d/"
27
cap_add:
28
- NET_ADMIN
29
restart: unless-stopped
Copied!
To persist data, the container mounts the host locations ./etc-pihole/ & ./etc-dnsmaq.d/
To combat iCloud Private Relay, which bypasses pihole, the additional option BLOCK_ICLOUD_PR: "true" has now been added.
File Breakdown:
Element
Meaning
TZ
Standard Format Timezone
WEBPASSWORD
Web Console Password
PIHOLE_DNS_
Target DNS Servers (Pihole will forward all non-blocked requests to these addresses
BLOCK_ICLOUD_PR
Drop iCloud Private Relay DNS Requests
WEBTHEME
Theme used by Web Console
  • Pi-Hole - The official Pi-Hole website
  • Firebog.net - a great selection of blocklists
  • 1.1.1.2 - Cloudflare's DNS resolver site
  • Quad9 - Quad9 homepage