1. 新建docker service 目录
mkdir /etc/systemd/system/docker.service.d
2. 新增http 代理配置
vi /etc/systemd/system/docker.service.d/http-proxy.conf
# 加入以下配置
[Service]
Environment="http_proxy=http://10.1.82.22:3128" "no_proxy=localhost,127.0.0.1,jinn.mirror.com,reg.lechange.com"
3. 重新加载docker 配置
systemctl daemon-reload
4. 重启docker
systemctl restart docker
遇到的问题:
Environment="http_proxy=http://10.1.82.22:3128" 的 HTTP_PROXY 为大写,代理不生效,报错Get https://registry.hub.docker.com/v2/: proxyconnect oversized record received with length 20527