Pi‑hole is a free, open‑source network‑wide ad blocker that works as a DNS sinkhole, intercepting DNS requests and blocking ads, trackers, and malicious domains before they reach your devices. It runs on lightweight Linux systems (often a Raspberry Pi) but can be installed on almost any server or container
I have two NVME SSDs installed in my DXP2800, mirrored, that I use to hold apps and docker containers. It's configured as /volume2. All of my docker containers are run from /volume2/docker
mkdir /volume2/docker/pihole
In /volume2/docker/pihole create docker-compose.yml
networks:
macvlan_net:
driver: macvlan
driver_opts:
parent: eth0 # Probably eth0. Use ifconfig to check
ipam:
config:
- subnet: 192.168.86.0/24 # You can find this by running ip addr show eth0 on your Ugreen NAS
gateway: 192.168.86.1 # You can find this by running ip route | grep default on your Ugreen NAS
services:
pihole:
image: pihole/pihole
container_name: pihole
networks:
macvlan_net:
ipv4_address: 192.168.86.xx #Assign a static IP within your subnet
security_opt:
- no-new-privileges:false
restart: on-failure:5 # This will make sure pihole is up pretty much all the time
volumes:
- /volume2/docker/pihole/dnsmasq.d:/etc/dnsmasq.d:rw
- /volume2/docker/pihole/pihole:/etc/pihole:rw
environment:
FTLCONF_webserver_api_password: <assign a pssword you want to use to log in>
FTLCONF_webserver_port: 8080 # port 8080 is a pretty common port. You might want to set this to something less common.
FTLCONF_dns_listeningMode: all
TZ: America/New_York
DNSMASQ_USER: pihole #or root (don't use root)
PIHOLE_UID: 1000
PIHOLE_GID: 10
cap_add:
- SYS_TIME
- SYS_NICE
From within /volume2/docker/pihole run:
docker compose up -d
View logs for pihole
docker logs pihole
Go to your router and set your primary DNS server to the address you set in your compose file.
Open your browser and go to http://<the address you defined in the compose file>:<FTLCONF_webserver_port as defined in the compose file>
Example: 192.168.86.xx:8080
If you find my content useful, please consider supporting this page: