Before anything, check your docker log settings. I had Unbound consuming 17GB alone.
https://docs.docker.com/config/containers/logging/json-file/
/etc/docker/daemon.json
{
"log-opts": {
"max-size": "20m",
"max-file": "3"
}
}
Save as local volume /etc/pihole/
, /etc/dnsmasq.d/
, /etc/resolv.conf
.
In case you have other process listening port 53, set Docker to listen ports only in your local IP 192.168.12.240
.
I had Virt-Manager listening to 192.168.122.1:53
so it can manage IP's for VM's.
Port 67 conflicts with Virt-Manager.
I set my host /etc/hosts
to map PiHole one with ro
read only attribute. Any change in the host /etc/hosts
need to restart PiHole container.
I changed healthcheck
command to 127.0.0.11
because this is the default DNS nameserver, and if Unbound is in a subnet, the original command fails because it uses 127.0.0.1
.
Use Unbound as upstream DNS. Save unbound.conf
into the mounted volume as per below configuration.
If you don't set the ip in the port 53, need to explicity set DNS, otherwise it can't connect to internet. That is because the host will have /etc/resolf.conf
set to nameserver 192.168.12.240
and the container needs to find it.
53:53
-> set dns
192.168.12.240:53
-> don't need dns
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
pihole:
container_name: pihole
hostname: pihole
image: pihole/pihole:latest
platform: linux/arm64
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
ports:
- "192.168.12.240:53:53/tcp"
- "192.168.12.240:53:53/udp"
#- "192.168.12.240:67:67/udp" # Only required if you are using Pi-hole as your DHCP server
- "192.168.12.240:9999:80/tcp"
environment:
TZ: 'America/Los_Angeles'
WEBPASSWORD: 'bruno123456'
FTLCONF_LOCAL_IPV4: '172.19.0.2'
PIHOLE_DNS_: '172.19.0.3#5335'
#DNSSEC: 'true'
#PIHOLE_DOMAIN: lan
# Volumes store your data between container upgrades
volumes:
- '/home/<username>/Docker/pihole/etc-pihole:/etc/pihole'
- '/home/<username>/Docker/pihole/etc-dnsmasq.d:/etc/dnsmasq.d'
- '/home/<username>/Docker/pihole/etc-resolv.conf:/etc/resolv.conf'
- '/etc/hosts:/etc/hosts:ro'
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
cap_add:
- NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
restart: unless-stopped
networks:
default:
ipv4_address: 172.19.0.2
#dns:
#- 172.19.0.1
unbound:
container_name: unbound
hostname: unbound
image: mvance/unbound-rpi:latest
volumes:
- '/home/<username>/Docker/unbound/etc-unbound:/opt/unbound/etc/unbound'
ports:
- "5335:53/tcp"
- "5335:53/udp"
restart: unless-stopped
networks:
default:
ipv4_address: 172.19.0.3
#dns:
#- 172.19.0.1
healthcheck:
test: ["CMD-SHELL", "drill @127.0.0.11 cloudflare.com || exit 1"]
networks:
default:
name: pihole-default
ipam:
driver: default
config:
- subnet: 172.19.0.0/16
gateway: 172.19.0.1
Enable firewall for your other docker subnets.
sudo ufw allow from 172.19.0.0/12 to any port 53