Docker Community Forums

Share and learn in the Docker community.

How to connect to Network from Docker Container


(Docccccker) #1

Hi All,

I am working on Docker for Windows- version -17.06.0-ce.
I am unable to connect to network from Docker container.
Can anyone help me with the configuration settings so that I would be able to connect with Network


(Vijaychandran) #2

What exact error you facing while connecting to network?


(Docccccker) #3

Hi,

It is giving error “No route to host” or “unknown host”. When I ping to
our proxy server/intranet server it replied saying " unable to reach
host".

Sayali Kandharkar
Tata Consultancy Services
Mailto: sayali.kandharkar@tcs.com
Website: http://www.tcs.com


(Anandbej) #4

sudo docker run -p 8000:80 -t -i --dns 10.0.0.1 d41c71c0a7fc
This command should be used if you are inside a network of connections. It allows you to access Internet inside the container. --dns specifies the general ip of your network

As a temporary solution to achieve Internet access if not attainable inside the container
Add the IP that you need to access to etc/hosts.

In my scenario, I couldn’t run apt-get update since there was no Internet access.

echo “91.189.92.201 archive.ubuntu.com” >> /etc/hosts
cat /etc/hosts
apt-get update