Docker Community Forums

Share and learn in the Docker community.

Docker Toolbox - Internet Connection in container

(Iiptyf) #1

I’m trying to connect to the internet in my container, which fails. Using Windows 7 and DockerToolbox-1.8.2c. I can ping successfully. But I can’t ping or ping its IP address.

The often suggested command “sysctl net.ipv4.ip_forward” returns “net.ipv4.ip_forward = 1”, both in the container and in the virtual machine.

“cat /etc/resolv.conf” in the container returns
"search xwlan
nameserver 212.x.x.x
nameserver 212.x.x.x" - nameservers are from my pc and xwlan is a dns connection suffix from my pc
I have tried starting the container with “–dns --dns --dns” - behaviour does not change

I have started a fresh debian, installed dnsutils and executed “dig @” which returned
; <<>> DiG 9.9.5-3ubuntu0.5-Ubuntu <<>> @
;; global options: +cmd
;; connection timed out; no servers could be reached"

When I set http_proxy & https_proxy within the container I can execute “wget”, although I have set them as ENV command in the DockerFile.

Additional note: I’m using a proxy. In order to install with apt-get, i have to set a proxy with this:
“cat << EOF >> /etc/apt/apt.conf.d/01proxy
Acquire::http::Proxy “http://x.x.x.x:yyyy”;

I’m out of ideas. Can someone point me in the right direction please?

(Mohammedazfar2015) #2

if you working on proxy network in Docker wares…

First you need to enable in Docker Daemon unit file like below
Environment=“http_proxy=http://proxy:9900” “https_proxy=http://proxy:9900” "NO_PROXY=localhost,"
additionally if you using in-house docker registry you can add in no_proxy list

I suspect you did restarted docker daemon after DNS Changes, if not you can give a try. Also you have an option to add --dns in docker daemon try this also . please let me know if this is works ?

(Iiptyf) #3

It’s been quite a while since then, and I moved on. I don’t know exactly how I figured it out. Looking back I think your hints go in the right direction.