Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

https://docs.docker.com/network/proxy/#configure-the-docker-client

No Format
cat << '"EOF'" >>~>~/docker_proxy_setup.sh
#!/bin/bash

#Proxy
ProxyVarActiveProxyVar="127.0.0.1:80"
ActiveProxyVar=$ProxyVar


#Domain
domainvar=domain.com

httpproxyvar=http://$ActiveProxyVar/
httpsproxyvar=http://$ActiveProxyVar/

#Domain
corpdom=alsglobal.com

mkdir ~/.docker
ftpproxyvar=ftp://$ActiveProxyVar/

cat << EOL >~/.docker/config.json
{
 "proxies":
 {
   "default":
   {
     "httpProxy": "$httpproxyvar",
     "httpsProxy": "$httpsproxyvar",
     "noProxy": ".$corpdom,127.0.0.0/8"
   }
 }
}
EOL

mkdir -p /etc/systemd/system/docker.service.d

>/etc/environment
no_proxy=localhost, 127.0.0.1, *.$domainvar
NO_PROXY=localhost, 127.0.0.1, *.$domainvar
http_proxy="$httpproxyvar"
HTTP_PROXY="$httpproxyvar"
https_proxy="$httpsproxyvar"
HTTPS_PROXY="$httpsproxyvar"
ftp_proxy="$ftpproxyvar"
FTP_PROXY="$ftpproxyvar"
EOL
cat /etc/environment

cat << EOL >/etc/apt/apt.conf.d/95proxies
Acquire::http::proxy "$httpproxyvar";
Acquire::ftp::proxy "$ftpproxyvar";
Acquire::https::proxy "$httpsproxyvar";
EOL
cat /etc/apt/apt.conf.d/95proxies

EOF
chmod +x ~/proxy_setup.sh
~/proxy_setup.sh

cat << 'EOF' >~/crt_import.sh
#!/bin/bash

dirname=zscaler
crtname=ZscalerRootCertificate-2048-SHA256

mkdir /usr/local/share/ca-certificates/$dirname
cat << EOL >/etcusr/local/systemdshare/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=$httpproxyvar"
Environment="HTTPS_PROXY=$httpsproxyvar"
Environment="NO_PROXY=localhost,127.0.0.1,.$corpdom"
EOL

systemctl daemon-reload
systemctl restart docker
#systemctl show --property Environment docker

docker run hello-worldca-certificates/$dirname/$crtname.crt
-----BEGIN CERTIFICATE-----
....
-----END CERTIFICATE-----
EOL
update-ca-certificates
EOF
chmod +x ~/dockercrt_proxy_setupimport.sh
~/dockercrt_proxy_setup.shimport.sh

echo "reboot or export environment variables before moving forward"