Issue: Other Docker Containers using Pi-hole Container for DNS resolution

Hi,

I'm having trouble connecting my other Docker Containers to the Pi-hole container for DNS resolution. Port 53 is published to the docker host, and the other Containers know to look for a DNS resolver in the local physical network (this actually being the docker host system itself).

Additional info: the Pi-hole container (10.0.0.2) has it's own bridge network (gateway 10.0.0.1)

The connection in one direction is working fine, I see all requests being resolved by the Pi-hole container. But the responses aren't returned correctly. As seen from the Pi-hole container the requests look like they're coming from the local gateway address (10.0.0.1), this is the same address when the docker host sends a DNS request.

I can bypass this issue by adding all containers to the Pi-hole bridge network (10.0.0.x), and setting the DNS address of all containers to 10.0.0.2. But this means I'm overwriting/ignoring the DNS server settings imposed by the DHCP server of the physical network. (/etc/resolv.conf of the docker host).

Another fix would be adding a secondary DNS server, but I really want to prevent non-Pi-holed DNS requests. As such I've configured my router to completely block port 53, block all communication to 8.8.8.8, 1.1.1.1, ... on all possible DOH ports. And I've only whitelisted 1.1.1.1 requests on port 443 coming from my Pi-Hole => Resulting in a very strict firewall.

I know this isn't an actual Pi-hole issue, but since it's related I was wondering if someone knew a fix for this?

Kind regards,
Frederic Depuydt

I'm having exactly the same issue. Did you manage to resolve this?

Hi,

I've worked arround the issue by using a MacVlan docker network. This exposes the Pi-Hole on a separate IP-Address in the network (also in another subnet and VLAN in my case). Requests now leave the containers via the standard eth0 interface address and are routed back to the Pi-Hole IP-Address by my router.

This requires:

  • Knowledge of VLAN and Trunking
  • Router that supports VLAN
  • Router that supports Multiple Subnets

I'm willing to go more in depth if you'd like to set this up as well.

Kind regards,
Frederic Depuydt

Frederic,

Are you able to share your docker-compose.yaml file that you used please? I am having challenges getting the docker container to serve anything attached to an existing macvlan network and hope it might give me some clues.

Thank you