Docker Community Forums

Share and learn in the Docker community.

DNS and maybe network issue in docker container

Hi !
I had initially the problem with docker-compose, unable to reach a debian update site
Then I was able to build the image with --network host.
Let’s try with a simple container : busybox

Here are the commands tested

docker run busybox nslookup google.com
;; connection timed out; no servers could be reached

docker run busybox ping (the same)
ping: bad address ‘google.com

docker run busybox ping 216.58.213.174
^CPING 216.58.213.174 (216.58.213.174): 56 data bytes
— 216.58.213.174 ping statistics —
51 packets transmitted, 0 packets received, 100% packet loss

docker run --network host busybox ping (the same)
PING (the same) (216.58.213.174): 56 data bytes
64 bytes from 216.58.213.174: seq=0 ttl=54 time=4.205 ms
64 bytes from 216.58.213.174: seq=1 ttl=54 time=4.319 ms
64 bytes from 216.58.213.174: seq=2 ttl=54 time=4.322 ms
^C
— (the same) ping statistics —
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 4.205/4.282/4.322 ms

Any idea, what is wrong with my setup ?

Debian GNU/Linux 10 (buster) 4.9.137-xxxx-std-ipv6-64

docker version
Client: Docker Engine - Community
Version:           19.03.2
API version:       1.40
Go version:        go1.12.8
Git commit:        6a30dfc
Built:             Thu Aug 29 05:29:29 2019
OS/Arch:           linux/amd64
Experimental:      false

Server: Docker Engine - Community
Engine:
 Version:          19.03.2
 API version:      1.40 (minimum version 1.12)
 Go version:       go1.12.8
 Git commit:       6a30dfc
 Built:            Thu Aug 29 05:28:05 2019
 OS/Arch:          linux/amd64
 Experimental:     false
containerd:
 Version:          1.2.6
 GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
 Version:          1.0.0-rc8
 GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
 Version:          0.18.0
 GitCommit:        fec3683

“When posting issues or feedback, make sure to remove any sensitive information and please provide the following:”

OS Version/build

Docker Engine Type/version

@iloreto sorry I forgot to paste that -> post updated

Similar post without any answer :

Following this :

This first test fails, so it might not be a DNS problem at first …

docker run busybox ping -c 1 192.203.230.10
PING 192.203.230.10 (192.203.230.10): 56 data bytes
— 192.203.230.10 ping statistics —
1 packets transmitted, 0 packets received, 100% packet loss

But this one works :

docker run --network host busybox ping -c 1 192.203.230.10
PING 192.203.230.10 (192.203.230.10): 56 data bytes
64 bytes from 192.203.230.10: seq=0 ttl=57 time=4.450 ms
— 192.203.230.10 ping statistics —
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 4.450/4.450/4.450 ms