Docker Community Forums

Share and learn in the Docker community.

DNS Problem, probably related to proxy?


(Iiptyf) #1

Hi, I’m trying to create an image using a dockerfile, which failes. I guess it’s because of my proxy settings. Using DockerToolbox-1.8.2c.

“FROM java:8-jdk
RUN apt-get update && apt-get install -y curl unzip zip inotify-tools”

I can pull images from docker hub, I achieved this by setting http_proxy, https_proxy, no_proxy, docker_tls and ntp_server in “/var/lib/boot2docker/profile”. I had to use the ip of the proxy. And now, the same problem happens with apt-get. The code above fails with

"W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/Release.gpg Cannot initiate the connection to httpredir.debian.org:80 (2001:41c8:1000:21::21:35). - connect (101: Network is unreachable) [IP: 2001:41c8:1000:21::21:35 80]“
and other errors. Also
"E: Package ‘zip’ has no installation candidate
E: Unable to locate package inotify-tools”.
So I could try again the use the IPs of the servers, but this seems like the wrong solution. In /etc/resolv.conf are my namerservers of the host already entered.

Anyone got better ideas?
I could also try to preload the packages and add them as static resource, as a workaround. Still not the way to go.
I’m at home now and disabled the vpn, so I can use the internet without a proxy. Still no luck


Docker commands from windows with proxy
(Jeff Anderson) #2

/var/lib/boot2docker/profile only affects processes running directly on the boot2docker host. Containers are still have their own isolated environment.

The quick fix for getting your container to build inside a network with a proxy is to simply set HTTP_PROXY, HTTPS_PROXY, and NO_PROXY inside the Dockerfile using the ENV directive.

Cheers!


(Iiptyf) #3

Thank you for your answer, I posted a follow up here: Docker commands from windows with proxy to clear out all problems, where this is just one of them.