Docker unable to reach external application

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 ‘test.mydomain.com

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

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

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…]

tried that but that wouldn’t help

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 test.mydomain.com
should work

nope the entries are different

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