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/ and /etc/dnsmasq.d/.
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.
Use Unbound as upstream DNS. Save unbound.conf into the mounted volume ./etc-unbound:/opt/unbound/etc/unbound 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/resolv.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
#- "127.0.0.1:9999:80/tcp" # use a proxy server to connect to 9999
#- "127.0.0.1:9993:443/tcp" # use a proxy server to connect to 9993
environment:
TZ: 'America/Los_Angeles'
WEBPASSWORD: 'somethingSecure'
PIHOLE_DNS_: 'unbound#53'
volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
# 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:
shared-net:
unbound:
container_name: unbound
hostname: unbound
image: mvance/unbound-rpi:latest
volumes:
- './etc-unbound:/opt/unbound/etc/unbound'
restart: unless-stopped
networks:
default:
shared-net:
networks:
default:
name: pihole-subnet
shared-net:
external: trueEdit ./etc-unbound/unbound.conf, add forward-zone to point to your network gateway.
forward-zone:
name: "."
forward-addr: 192.168.12.1@53Add NPM and PiHole to shared-net, then add a proxy to http://pihole:80.
Create file in container (or use mapped volume)
/etc/dnsmasq.d/custom.conf
txt-record=myserver.mydomain,"hello world"Change setting in container (or use mapped volume)
/etc/pihole/pihole.toml
etc_dnsmasq_d = trueRestart container.
Test with
dig myserver.mydomain TXT