0

To begin with, I am behind a corporate proxy. I'm using docker 1.12.0

Using OSX, my .bash_profile looks like this:

export http_proxy='http://server-ip:port/'
export https_proxy='http://server-ip:port/'
export no_proxy='localhost,0.0.0.0,127.0.0.1'

What puzzles me is that I am able to pull the ubuntu image without any problems.

docker pull ubuntu:latest

When I attempt to pull centos I get the following error:

docker pull centos:latest
latest: Pulling from library/centos
8d30e94188e7: Pulling fs layer 

dial tcp i/o timeout

I've ready through this post about centos connection issues. I believe I have followed the suggested answers but still no luck.

I am able to pull the image without any problems on my personal machine, so I know it must be something with the proxy. Any suggestions are greatly appreciated!

Community
  • 1
  • 1
Damon
  • 4,151
  • 13
  • 52
  • 108
  • Possible duplicate of [Docker/Boot2Docker: Set http/https proxies for docker on osx](http://stackoverflow.com/questions/24489265/docker-boot2docker-set-http-https-proxies-for-docker-on-osx) – BMitch Sep 08 '16 at 17:50

3 Answers3

1

This is painfully obvious now, and instead of turning to the internet first, I should have simply checked preference options.

In Docker for Mac, v1.12.0 once installed, click on the docker icon in the toolbar (upper right corner next to the clock) and choose "Preferences".

Under the "Advanced" tab, you can enter proxy information.

Thank you BMitch for your time, I appreciate it!

Damon
  • 4,151
  • 13
  • 52
  • 108
0

Please pull and save image on your laptop. Transfer the image to the server with no internet connection and use docker load.

Hope this works.

Karthik427
  • 11
  • 3
0

Setting the environment variables in your .bashrc will update the network config for any commands you run as the user. However, Docker is designed as a client/server app, and the image pulls are run from the server (dockerd). Docker has docs on how to configure systemd with a proxy that should solve your issue. In brief, you need to adjust the following:

sudo -s
mkdir /etc/systemd/system/docker.service.d
cat >/etc/systemd/system/docker.service.d/http-proxy.conf <<EOF
[Service]
Environment="HTTP_PROXY=http://server-ip:port/"
EOF
systemctl daemon-reload
systemctl restart docker
exit

If you don't have systemd installed, you should be able to edit /etc/default/docker. The entry you need to add there is export http_proxy="http://server-ip:port/".

Lastly, I'm now seeing that you're on MacOS (the question about CentOS is a red herring since I'm sure you can't pull any image and you're not actually running CentOS). In boot2docker, you have the following procedure:

boot2docker ssh
sudo vi /var/lib/boot2docker/profile 
# include your "export HTTP_PROXY=http://server-ip:port/" here
sudo /etc/init.d/docker restart
exit
BMitch
  • 231,797
  • 42
  • 475
  • 450
  • Hi BMitch, Thank you for your response! You are correct. My physical machine is MacOS. I am attempting to pull the `centos` image. I don't have `systemd` installed & I don't seem to have this dir/file: `/etc/default/docker`. It looks like `boot2docker` has been deprecated? I'm not sure what file(s) I should look for. – Damon Sep 08 '16 at 20:55
  • Connect directly to your docker host vm with a shell using whatever CLI Docker gives you on MacOS. You need to be inside the VM to configure this, and I'm pretty sure it's still boot2docker under the covers. It looks like they've even given you a menu (advanced) for setting the http proxies in Docker for Mac: https://docs.docker.com/docker-for-mac/ – BMitch Sep 08 '16 at 21:36
  • Yep - feeling pretty silly right about now. Thank you again. – Damon Sep 08 '16 at 21:42