Local dns record not resolvable inside docker container

Hi,

I've a dyndns server inside my local network and added a local DNS record in pihole:
server.dyndns.org :arrow_right: 192.168.0.10

This works fine for local network clients but docker containers with bridge network fail to resolve "server.dyndns.org".

nslookup server.dyndns.org
Server:         127.0.0.11
Address:        127.0.0.11#53

Non-authoritative answer:
*** Can't find server.dyndns.org: No answer

Despite this, the container is able to ping 192.168.0.10 and to resolve the local server name.

I don't know, why exactly this is happening, if this is an issue with pihole or docker networking. Is there any solution to configure pihole or docker to correctly resolve the dyndns address directly to a local network ip?

Greets, ManOki

That's the DNS server that Docker engine uses internally for resolving container names. That's not Pi-hole.

The docker documentation is somewhat inprecise at this point: https://docs.docker.com/config/containers/container-networking/

As I mentioned, I don't know how exactly the docker dns resolution and pihole interact with each other in detail. Apparently, docker is able to resolve the local host name to the local ip 192.168.0.10 and the container can ping/connect to this ip address.

As I unterstand the documentation, docker use the host dns resolution, i.e., the pihole. Of course inside the container, the dns server ip is another one managed by docker. So is this an issue with docker dns resolution which intervenes and disallows to pass a local ip address to the container?

Are you sure that the Docker host system uses Pi-hole for its DNS resolution? When you install Pi-hole, on that server the DNS entry not changed since some Pi-hole versions ago, hence the previous upstream DNS is used as long as you do not change it manually.

Could you share the exact series of commands used to produce your output?

It is unclear whether that nslookup was run from your Docker host or from inside a container (and inside which one, in case you are not just running a Pi-hole container).

It's sensible to verify that, especially if nslookup was run from the Docker host.
(Note that Docker host DNS settings always have been a separate configuration issue, as the internal DNS settings for Pi-hole's container are controlled by the Docker container ;))

Ok, now I can't replay the situation, I tested all commands again and this time the dyndns address is correctly resolved to the local ip even for the docker instance.

Maybe @MichaIng was right. From my point of view docker itself did not updated its dns resolution after the host used the new dns server. I assume this, because the host was already able to correctly resolve the dyndns address to the local ip, but the docker instance failed to resolve (as mentioned in the first post). In the meantime I rebooted everthing, so dns cache probably vanished and the correct setup was used immediately.

Thanks for all the help!