docker using proxy code example

Example 1: using docker behind proxy

# Create a drop-in
mkdir /etc/systemd/system/docker.service.d

# Put this in there (only up until the ##):

[Service]
Environment="HTTP_PROXY=http://user01:[email protected]:8080/"
Environment="HTTPS_PROXY=https://user01:[email protected]:8080/"
Environment="NO_PROXY= hostname.example.com,172.10.10.10"

##

# Then run these commands to reload the systemd daemon and restart docker
systemctl daemon-reload
systemctl restart docker

Example 2: docker proxy

{
 "proxies":
 {
   "default":
   {
     "httpProxy": "http://127.0.0.1:3001",
     "httpsProxy": "http://127.0.0.1:3001",
     "noProxy": "*.test.example.com,.example2.com,127.0.0.0/8"
   }
 }
}

Tags:

Misc Example