Docker windows now support host networking. I was thinking that using this config instead of bridge mode could help to get visibility on the client name doing a DNS query instead of getting only localhost on my piholer container.
I started the container with this setting, pihole container is accessible through localhost or server IP directly and working properly. But it’s not resolving the client name issue.
But why would you get localhost? And where? You mean the dns server logs a request came from localhost?
Is the pihole container the DNS server?
If it also uses the host network, getting localhost seems right. If pihole doesn’t use the host network, I’m not sure what I should expect. Do you want to get the host machine’s IP?
It is looking like that , all request are seen from container IP. I was thinking that using host networking would help to resolve the host name. Right if I got a host in my network doing bad request I have no way to know which one is it
It is still not clear to me what you exactly do. I’m afraid I got only parts of it. Can you share a specific example to clarify what is sending the DNS query from where to where?
In your first post you wrote
So I thought you got “localhost” when you used the default bridge network and you thought host network would solve it. That is what didn’t make sense to me and asked why you would get localhost.
Now I get the feeling you originally got the IP of the Docker network gateway so you tried the host network and you started to get localhost. You would get the IP of the Dockr network gateway only if you tried to send the DNS query from the Windows host. Then if you try the host network, getting localhost is expected.
If you try to access it from another machine, I’m not sure what is expected. As I wrote, this host network is not a real host network. There are also multiple reports and discussions on the forum and on GiHub about containers in about Docker Desktop not getting the real IP. It is not a bug just how it was implemented for development only I guess.
Thanks for taking the time to answer. I guess it’s not possible because of the implementation. When I was using pihole container on my Synology I was able to get the name of the device that did the DNS request or at the IP addrr. With docker windows I’m getting the pihole IP or localhost only.
Even with host networking on Docker for Windows, all DNS queries from containers still appear to come from the host itself, not the actual clients. This is a Windows networking limitation. To see real client names in Pi-hole, you’d need to run it directly on the host or use an external DHCP server that registers client hostnames.