Help setting up parameters in docker-compose.env
mondsen opened this issue · 4 comments
First of all, thank you for providing this. I am currently using pi-hole + unbound + hyperlocal on my Raspberry Pi ZeroW. It works, but somehow struggles with WLAN connection. Thus I have to migrate to my wired Raspberry Pi4 and would like to use your docker setup.
My network:
192.168.178.1: router (uses domain fritz.box)
192.168.178.78: rp4 (here I would like to host your docker files --> new DNS)
192.168.178.200: rpzero (my current and soon old DNS)
I am struggling to understand the internal IP management in the docker file. I thought, IPs in docker are internal (docker provides an own network configuration). Therefore I don't understand why I have to provide individual IP adresses for pihole and unbound. I have never used MACVLAN and I am not experienced with docker network configurations. Any help would be appreciated.
Furthermore, what do I need to specify for
section pihole
domainname
VIRTUAL_HOST
CORS_HOST
REV_SERVER_DOMAIN
section unbound
domainname
volumes (can I just use everything after <>?)
section networks
how do these settings correlate to the settings above?
Hello and thanks for reaching out. I'm currently on vacation so bear with me if my responses are taking longer as expected. I suggest to start with a bridged configuration instead of a MACVLAN network to avoid frustrations by using advanced configurations for starters. You would need to provide network details (MAC address and IP address) for the hosts only if you intend to use a MACVLAN config. If so you also need to specify an IP range where the IP addresses for both machines will be reserved and then configured for the hosts in their respective sections. This will be done in the MACVLAN network configuration at the end of the file underneath the ipam section. I hope this answers your question regarding section networks
Furthermore, what do I need to specify for
section pihole
- The domain name would be the network name your are using for your home network, i.e. myprivate.lan. You should set the same domain as your fritz.box is using.
- The virtual_host variable can be used if you want to access the container with a different name than pi.hole. You can omit this.
- CORS_HOST and REV_SERVER_DOMAIN is needed if you want to use conditional forwarding, see the Pi-hole readme. This can also be omitted and set later in the Pi-hole GUI.
section unbound
- For the domainname see my answer for Pi-hole above, the machines should be in the same "domain".
- Sure, you can use exactly the volumes but need to adapt the originating folders on your Raspberry (the settings in angle brackets). If you have already mounted volumes for Pi-hole, you could use them as a blueprint, they work the same way for Unbound. The settings for your source volumes depend on one's setup, so this can't be generalized.
Could you provide your failing docker-compose file without any private details, please?
I'll simplify and provide more example docker-compose files since I don't think it's a good idea to show advanced networking principles in an example. This is confusing for real. I like to have a MACVLAN configuration because I want to have the hosts behaving like separate machines on my network. This has also another drawback that the host which is running Pi-hole and Unbound cannot access the container's services as the MACVLAN network is isolated from the host which is no problem for me as I use another forwarder for the host running Pi-hole and Unbound to provide name resolution.
I thought it was a good idea to provide such an example as I was struggling to make it run when I started using Pi-hole with Unbound. Obviously it isn't. Sorry for that.
Thanks for using my image, please get back to me if you want me to view your docker-compose.yaml or something wasn't clear. Yup, I had a few beers already. 🍻
Thanks for your reply. I changed the networks section to this now:
networks:
dns-network:
driver: bridge
But now I am searching the internet for a proper solution for pointing the pi-hole container dns to the unbound container. There is a possibility to used fixed IPs within the service configuration, but I would like to have a more "robust" solution. Do you know if it is possible to use the container_name in the dns part for the pi-hole configuration? My guess is no, because I have only seen examples using IPs. Any recommendation for this?
Let's try it like so :
Configure the following in the networks section:
networks:
dns-network:
driver: macvlan
driver_opts:
parent: <eth0> #Adapt this to your raspberrys network interface
ipam:
config:
- subnet: 192.168.178.0/24
gateway: 192.168.178.1
ip_range: 192.168.178.253/30
Give Pi-hole the following IP address: 192.168.178.254
and Unbound the following IP address: 192.168.178.253
You need to make sure that the DHCP Server of your router doesn't assing the. 253 and. 254 IPs. May you can make a reservation of this small range.