docker 设置代理

1、创建目录

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

2、创建文件/etc/systemd/system/docker.service.d/http-proxy.conf,内容如下:

[Service]
Environment=“HTTP_PROXY=http://10.245.3.1:8080/”

3、重启docker

systemctl daemon-reload
systemctl restart docker
 

4、验证docker代理是否设置成功

systemctl show --property=Environment docker

5、显示如下结果说明设置成功

Environment=GOTRACEBACK=crash HTTP_PROXY=http://10.245.3.1:8080/

git 命令设置代理

/ 查看当前代理设置

git config –global http.proxy

// 设置当前代理为 http://127.0.0.1:1080 或 socket5://127.0.0.1:1080

git config –global http.proxy ‘http://127.0.0.1:1080’

git config –global https.proxy ‘http://127.0.0.1:1080’

git config –global http.proxy ‘socks5://127.0.0.1:1080’

git config –global https.proxy ‘socks5://127.0.0.1:1080’ /

/

作者:小木豆Macro
链接:https://www.jianshu.com/p/de1fa1e06fa1
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。