chuvpne/pne-docker

No DNS access from the container

Closed this issue · 0 comments

Version info

$ uname -a
Linux LAB02228 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018
x86_64 x86_64 x86_64 GNU/Linux
$ sudo docker version
Client:
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:48:57 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:16:44 2018
  OS/Arch:          linux/amd64
  Experimental:     false

ping www.google.com from host works

$ ping www.google.com
PING www.google.com (173.194.76.99) 56(84) bytes of data.
64 bytes from ws-in-f99.1e100.net (173.194.76.99): icmp_seq=1 ttl=40 time=18.5 ms

ping www.google.com from container does not work

$ sudo docker run --rm -it -p 8787:8787 -e USER=$USER -e USERID=$UID -e PASSWORD=$PW \
chuvpne/pne-docker /bin/bash -c 'ping www.google.com'

ping www.google.com IP from container works

$ sudo docker run --rm -it -p 8787:8787 -e USER=$USER -e USERID=$UID -e PASSWORD=$PW \
chuvpne/pne-docker /bin/bash -c 'ping 173.194.76.99'
PING 173.194.76.99 (173.194.76.99) 56(84) bytes of data.
64 bytes from 173.194.76.99: icmp_seq=1 ttl=39 time=18.6 ms

"SOLVED" by using the --net=host option in docker run

$ sudo docker run --rm -it -p 8787:8787 -e USER=$USER -e USERID=$UID -e PASSWORD=$PW \
--net=host chuvpne/pne-docker /bin/bash -c 'ping www.google.com'
WARNING: Published ports are discarded when using host network mode
PING www.google.com (173.194.76.99) 56(84) bytes of data.
64 bytes from ws-in-f99.1e100.net (173.194.76.99): icmp_seq=1 ttl=40 time=18.5 ms