- 步驟1:創(chuàng)建/lib/systemd/system/docker.service.d文件夾
mkdir -p /lib/systemd/system/docker.service.d
- 步驟2:在 /lib/systemd/system/docker.service.d文件夾下創(chuàng)建 http-proxy.conf 文件献宫,并且將以下內(nèi)容寫入到http-proxy.conf 中剥哑。需要更換 xxx.xxx.xxx.xxx 為代理的IP地址吼蚁,0000為代理的端口號(hào)断国。
vim /lib/systemd/system/docker.service.d/http-proxy.conf
http-proxy.conf 文件
# http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://xxx.xxx.xxx.xxx:0000" " HTTPS_PROXY=http://xxx.xxx.xxx.xxx:0000"
- 步驟3:更新配置并重啟Docker服務(wù)以生效骂束。
systemctl daemon-reload
systemctl restart docker