Open Nedlinin opened 4 years ago
Thanks for this-- I don't use Pi-Hole for DHCP so I've not tested it. Can you make a pull request with your fixes to the repo?
@chriscrowe : I mistyped my original report saying I had modified the readme but intended to say the readme should be modified to contain this information.
In the end, DHCP works as expected you just have to know to mount the file into the container such that pihole sees and applies it.
@Nedlinin could you please provide your full docker-compose
? It seems, there are also further configurations needed in order to get DHCP working (like network_mode
, etc.). I have issues with DHCP (long story short: DHCP is simply not working, i deactivate the DHCP service on my router and activated it in Pi-Hole -> no internet connection). I am using the one-container example docker-compose.
For completeness, here is my setup (yes, web port is 81
instead 80
):
.env
ServerIP=192.168.178.34
TZ=Europe/Berlin
WEBPASSWORD=secret
REV_SERVER=true
REV_SERVER_DOMAIN=local
REV_SERVER_TARGET=192.168.178.1
REV_SERVER_CIDR=192.168.178.0/16
HOSTNAME=nuc
DOMAIN_NAME=pihole.local
docker-compose.yml
version: '2'
volumes:
etc_pihole-unbound:
etc_pihole_dnsmasq-unbound:
services:
pihole:
container_name: pihole
image: cbcrowe/pihole-unbound:latest
hostname: ${HOSTNAME}
domainname: ${DOMAIN_NAME}
ports:
- 444:443/tcp
- 53:53/tcp
- 53:53/udp
- 81:80/tcp
- 67:67/udp # Only required if you are using Pi-hole as your DHCP server
- 5335:5335/tcp # Uncomment to enable unbound access on local server
#- 22/tcp # Uncomment to enable SSH
cap_add:
- NET_ADMIN
environment:
ServerIP: ${ServerIP}
#WEB_PORT: 81
#network_mode: host
TZ: ${TZ}
WEBPASSWORD: ${WEBPASSWORD}
REV_SERVER: ${REV_SERVER}
REV_SERVER_TARGET: ${REV_SERVER_TARGET}
REV_SERVER_DOMAIN: ${REV_SERVER_DOMAIN}
REV_SERVER_CIDR: ${REV_SERVER_CIDR}
DNS1: 127.0.0.1#5335 # Hardcoded to our Unbound server
DNS2: 127.0.0.1#5335 # Hardcoded to our Unbound server
DNSSEC: "true" # Enable DNSSEC
volumes:
- etc_pihole-unbound:/etc/pihole:rw
- etc_pihole_dnsmasq-unbound:/etc/dnsmasq.d:rw
restart: always
Unfortunately I've migrated over to Adguard Home so I can't say I use this any longer.
The last backup of my config is as follows (with some redactions). This config might have been when I had already partially migrated to Adguard and, as such, you might need to bring back the commented out volume mounts.
Hope this at least gives you some ideas. Good luck!
version: '3.7'
services:
pihole:
container_name: pihole
...
hostname: pi-hole
mac_address: d0:ca:ab:cd:ef:01
cap_add:
- NET_ADMIN
ports:
- 443/tcp
- 53/tcp
- 53/udp
- 67/udp
- 80/tcp
- 22/tcp
environment:
ServerIP: 192.168.1.5
WEBPASSWORD: ${WEBPASSWORD}
volumes:
- /volume4/docker/pihole-unbound/pihole/volume:/etc/pihole
# - /volume4/docker/pihole-unbound/pihole/config/hosts:/etc/hosts
# - /volume4/docker/pihole-unbound/pihole/config/resolv.conf:/etc/resolv.conf
# - /volume4/docker/pihole-unbound/pihole/config/dnsmasq:/etc/dnsmasq.d
# - /volume4/docker/pihole-unbound/pihole/config/pihole-dhcp.conf:/etc/dnsmasq.d/02-pihole-dhcp.conf:rw
# - /volume4/docker/pihole-unbound/pihole/config/pihole-static-dhcp.conf:/etc/dnsmasq.d/04-pihole-static-dhcp.conf:rw
# - /volume4/docker/pihole-unbound/pihole/config/pihole-FTL.conf:/etc/pihole/pihole-FTL.conf
networks:
home:
ipv4_address: 192.168.1.5
restart: always
networks:
home:
driver: macvlan
driver_opts:
parent: ovs_eth0
ipam:
config:
- subnet: 192.168.1.0/24
If you enable DHCP and change settings or create reservations they are lost on container recreation.
https://discourse.pi-hole.net/t/what-files-does-pi-hole-use/1684
This explains the files required. I modified the readme and added a file mounted inside the container for the 2 DHCP ones
But this should likely be documented somewhere.