Docker Pull设置代理解决Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection
·
今天搭建k8s集群时,发现一系列k8s.gcr.io的镜像无法pull:
-<%>- docker pull k8s.gcr.io/kube-proxy
Using default tag: latest
Error response from daemon: Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
原来是万恶的某沃尔,需要为docker设置代理,并重启docker daemon:
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/proxy.conf
sudo chmod 777 /etc/systemd/system/docker.service.d/proxy.conf
sudo echo '
[Service]
Environment="HTTP_PROXY=http://proxy.xxx.com:8888/"
Environment="HTTPS_PROXY=http://proxy.xxx.com:8888/"
' >> /etc/systemd/system/docker.service.d/proxy.conf
sudo systemctl daemon-reload
sudo systemctl restart docker
通过systemctl查看配置结果:
sudo systemctl show --property=Environment docker
之后再次拉取镜像,成功。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)