I have a docker container running on a linux host. The linux host has a hostname of ‘jrm-dev1’.
I am able to ping my linux host and access services running separately on my host, using the hostname ‘jrm-dev1’, with no extra configuration.
While this is no bad thing for my setup, I need to understand how I have arrived at this situation as other installations typically cannot do this.
As I understand, docker copies the DNS entries found in /etc/resolv.conf to containers, stripping out any local servers, as detailed here. This is why it is typically not possible to ping the host via its’ hostname (leading to plenty of questions and different solutions).
Now, if I look in my own /etc/resolv.conf, I have:
nameserver 127.0.0.53 options edns0
So I think nothing should be copied across to docker here?
Likewise, I have no DNS settings configured in my /etc/docker/daemon.json.
However, if I do an nslookup on the docker bridge network, I get:
nslookup 172.17.0.1 188.8.131.52.in-addr.arpa name =jrm-dev1. 184.108.40.206.in-addr.arpa name = jrm-dev1.local.
And every custom network I create resolves to the same address - is that normal or is it exceptional for my case?