Docker Community Forums

Share and learn in the Docker community.

Strange DNS problems in cointainer

dns

(Mghermansen) #1

Hello!

I have the strangest problem in that DNS is not working for normal users inside the container until the root user has done a lookup - but only for a while and then its not working anymore.

The container created from the debian:8.6 image.
Note that in the following trace I run bash inside the container first as a normal user, then root and then the normal user again.


Inside the container:

devel@stadsdevel:~$ hostname
stadsdevel
devel$ id
uid=1000(devel) gid=1000(devel) groups=1000(devel)
devel$ ping stadsdevel
ping: unknown host
devel$ ping www,google,com
ping: unknown host

DNS not working for normal user - not even local host name

devel$ su -
Password: 
root# ping stadsdevel
PING stadsdevel (172,17,0,2): 56 data bytes
64 bytes from 172,17,0,2: icmp_seq=0 ttl=64 time=0.133 ms
64 bytes from 172,17,0,2: icmp_seq=1 ttl=64 time=0.114 ms
^C--- stadsdevel ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.114/0.123/0.133/0.000 ms
root# ping www,google,com
PING www,google,com (216,58,197,68): 56 data bytes
64 bytes from 216,58,197,68: icmp_seq=0 ttl=127 time=356.648 ms
64 bytes from 216,58,197,68: icmp_seq=1 ttl=127 time=357.211 ms
^C--- www,google,com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 356.648/356.930/357.211/0.282 ms

DNS works when changing to the root user

root# exit
logout
devel$ id
uid=1000(devel) gid=1000(devel) groups=1000(devel)
devel$ date
Thu Nov 24 15:20:35 UTC 2016
devel$ ping stadsdevel
PING stadsdevel (172,17,0,2): 56 data bytes
64 bytes from 172,17,0,2: icmp_seq=0 ttl=64 time=0.050 ms
64 bytes from 172,17,0,2: icmp_seq=1 ttl=64 time=0.065 ms
^C--- stadsdevel ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.050/0.058/0.065/0.000 ms
devel$ ping www,google,com
PING www,google,com (216,58,197,68): 56 data bytes
64 bytes from 216.58.197.68: icmp_seq=0 ttl=127 time=356.216 ms
64 bytes from 216.58.197.68: icmp_seq=1 ttl=127 time=356.203 ms
^C--- www,google,com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 356.203/356.209/356.216/0.000 ms

DNS now also works for the normal user - for a while

devel$ date
Thu Nov 24 15:29:25 UTC 2016
devel$ ping stadsdevel
ping: unknown host

Now after about 10 minutes DNS is not working anymore for the normal user

Some info on my Docker host:
dockerhost# docker info
Containers: 25
Images: 858
Server Version: 1.9.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: nfs
Dirs: 910
Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
CPUs: 4
Total Memory: 7.805 GiB
Name: dockerhost
ID: TVK6:Q6SM:W2KW:7YJQ:A6BP:2AS5:L7PG:Z5VN:SZNJ:UEAF:5SGL:FBVH
WARNING: No memory limit support
WARNING: No swap limit support
root# docker info
Containers: 25
Images: 858
Server Version: 1.9.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: nfs
Dirs: 910
Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
CPUs: 4
Total Memory: 7.805 GiB
Name: dockerhost
ID: TVK6:Q6SM:W2KW:7YJQ:A6BP:2AS5:L7PG:Z5VN:SZNJ:UEAF:5SGL:FBVH
WARNING: No memory limit support
WARNING: No swap limit support

This is the stranges thing in the world. Any hints on why I have this problem?

Best regards,

  • Morten Green Hermansen