Pi-Hole in Docker Swarm

装好Pi-Hole之后才发现,无法屏蔽YouTube广告……

安装Pi-Hole的过程比较简单,唯一要注意的是不要改变80端口。pihole-stack.yml内容如下:

version: "3.7"

services:
pihole:
image: pihole/pihole:v4.4
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "80:80/tcp"
- "3443:443/tcp"
volumes:
- piholeconfig:/etc/pihole/
environment:
TZ: 'America/Los_Angeles'
WEBPASSWORD: "${WEBPASSWORD}"
ServerIP: "${SERVERIP}"
DNS1: '208.67.222.222'
DNS2: '208.67.220.220'
dns:
- 127.0.0.1
- ${DNSIP}
deploy:
replicas: 1

volumes:
piholeconfig:
driver: local
driver_opts:
type: "nfs4"
o: "addr=${PIHOLE_NFS_SERVER},rw"
device: ":/pihole"

首次尝试时使用了”3080:80/tcp”,出现如下错误信息:

Unable to parse results from queryads.php: Unhandled error message (Invalid domain!)

启动Docker命令如下:

$ PIHOLE_NFS_SERVER=192.168.1.2 DNSIP=192.168.1.1 SERVERIP=192.168.1.3 WEBPASSWORD='12345' docker stack deploy -c pihole-stack.yml pihole