Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Docker via proxy

Konstantin Chayka edited this page Mar 2, 2021 · 1 revision

If you need to setup docker daemon use proxy (source)

Create or check existence sudo mkdir -p /etc/systemd/system/docker.service.d
Into /etc/systemd/system/docker.service.d/http-proxy.conf add

[Service]
Environment="HTTP_PROXY=http://proxy.example.com:port/"

Into /etc/systemd/system/docker.service.d/https-proxy.conf add

[Service]
Environment="HTTPS_PROXY=https://proxy.example.com:port/"

After it:
sudo systemctl daemon-reload
sudo systemctl restart docker

If you need to setup newly created use proxy

Add into ~/.docker/config.json

{
 "proxies":
 {
   "default":
   {
     "httpProxy": "http://proxy.example.com:port/",
     "httpsProxy": "https://proxy.example.com:port/"
   }
 }
}

Another way to setup docker daemon to use proxy (not working)

Into /etc/default/docker add after line # If you need Docker to use an HTTP proxy, it can also be specified here.

export http_proxy="http://proxy.example.com:port/"
export https_proxy="https://proxy.example.com:port/"