Docker 设置代理
- 创建配置文件
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/proxy.conf
sudo vim /etc/systemd/system/docker.service.d/proxy.conf
- 编辑代理配置
#输入以下内容,其中代理改成自己的,[Service]不能丢
[Service]
Environment="HTTP_PROXY=http://192.168.81.1:7890"
Environment="HTTPS_PROXY=http://192.168.81.1:7890"
- 重启服务,检查代理是否生效
[root@k8s-node03 ~]# systemctl daemon-reload
[root@k8s-node03 ~]# systemctl restart docker
[root@k8s-node03 ~]# docker info | grep "Proxy"
HTTP Proxy: http://192.168.81.1:7890
HTTPS Proxy: http://192.168.81.1:7890
[root@k8s-node03 ~]#