Docker Community Forums

Share and learn in the Docker community.

Docker unable to reach external application

(Deepdiddi) #1

I have docker installed on my centos 7. from centos host machine i can ping and telnet to external application , but if i login to any docker container i can not ping nor telnet to external application and this is what i see

Couldn’t resolve host ‘

(Sam) #2

what is in the /etc/resolv.conf inside the container?

(Deepdiddi) #3

there is entry for nameserver but i would not be using it, as i made the entries of the external system in /etc/hosts file of host machine. Could not edit resolv.conf inside the container as it was read only

(Sam) #4

IF you MANUALLY ADDED the name, then you will MANUALLY have to add it to the container info on the docker run

–add-host name:ip_address[,name:ip_address…]

(Deepdiddi) #5

tried that but that wouldn’t help

(Sam) #6

don’t understand…

if you do docker exec container_id cat /etc/hosts

what do you see? the name/ip should be there, JUST like it is on your host

docker exec container_id ping
should work

(Deepdiddi) #7

nope the entries are different

(Sam) #8

explain more… if you did the --add-host on the docker run, then it should be in the containers hosts file