Docker Community Forums

Share and learn in the Docker community.

Changes to /etc//resolv.conf are not getting reflected

Hello,

Our application is facing a problem where any changes to /etc/resolv.conf are not getting reflected to the file that process is looking at.

The file contents collected from gdb of the process are like this:

(gdb) p (int) system("cat /etc/resolv.conf > /benu-data/admin/resol")
$8 = 0
(gdb) quit
root@nk-up:/benu-data/admin# cat resol
nameserver 10.96.0.10
search nkottapalli.svc.cluster.local svc.cluster.local cluster.local 
options ndots:5

Whereas the contents of the file in the default and our application namespace looks like below.

root@nk-up:/benu-data/admin# cat /etc/resolv.conf
nameserver 172.18.58.122
nameserver 10.96.0.10
search nkottapalli.svc.cluster.local svc.cluster.local cluster.local 
options ndots:5
root@nk-up:/benu-data/admin# cat /etc/netns/BenuApplication/resolv.conf
nameserver 172.18.58.122
nameserver 10.96.0.10
search nkottapalli.svc.cluster.local svc.cluster.local cluster.local 
options ndots:5
root@nk-up:/benu-data/admin# ip netns exec BenuApplication bash
root@nk-up:/benu-data/admin# cat /etc/resolv.conf
nameserver 172.18.58.122
nameserver 10.96.0.10
search nkottapalli.svc.cluster.local svc.cluster.local cluster.local 
options ndots:5

Can anyone answer when and why would this happen?

It looks like it is Kubernetes, but it is not clear to me what is the “process”:

Also, is “nk-up” is a container? How dou you change resolv.conf?

note that I have no idea what this benuapp is. The name is familiar but I don’t know why.

Here process means the application which is sending a DNS query using res_search. Above output is collected from the gdb session of that application.

Yes, “nk-up” is a container.

File resolv.conf was changed manually in the container and in the namespace inside container.

The DNS queries are expected to be sent to IP 172.18.58.122 rather than 10.96.0.10. But since the file that the application is referring doesn’t have the namerserver entry pointing to 172.18.58.122, res_search is failing.