Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pulling docker images behind a proxy

I have been having trouble using docker whenever I am on my campus' wifi. Trying to pull or run an image which needs to be pulled gives me the following error:

Error while pulling image: Get https://index.docker.io/v1/repositories/library/redis/images: dial tcp: lookup index.docker.io on 66.170.14.12:53: server misbehaving

My research has lead me across this post which seems consistent with what I'm experiencing, but the proposed fix has not worked. What can I do to avoid this issue in the future?

like image 415
AmenRadix Avatar asked Feb 15 '26 19:02

AmenRadix


1 Answers

As I explained in another context (Windows, corporate proxy), you need to set HTTP_PROXY environment variables in your Dockerfile (if your Dockerfile needs to access internet) or in your session environment variables (in a .profile or .bashrc):

export HTTP_PROXY=http://<user>:<pwd>@proxy.company:80
export HTTPS_PROXY=http://<user>:<pwd>@proxy.company:80
export NO_PROXY=.company,.sock,localhost,127.0.0.1,::1,192.168.59.103

Note that with docker 1.9, you will be able to leave those outside Dockerfile with build-timeargument passing (merge in PR 15182).

like image 95
VonC Avatar answered Feb 18 '26 22:02

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!