Installing docker behind a proxy

Installing docker behind a proxy

If you are trying to install docker behind a proxy, you might run into multiple problems.
The first one is getting the gpg key for apt.
From the install instructions for ubuntu, you see the directive to download the apt key. What they don’t tell you on that page is that you need an extra cli option like so:

sudo apt-key adv --keyserver-options http-proxy=http://proxy.example.com:8080/ --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

Pulling images behind a proxy

And then of course since you’re behind that proxy, you might have issues with docker downloading images.
Here are the condensed instructions from the full explanation at the official docker docs.

mkdir /etc/systemd/system/docker.service.d
cat </etc/sytemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"
EOF
systemctl daemon-reload
systemctl restart docker

Reference

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s