最近docker非常不稳定,经常在docker pull的时候Error response from daemon: Get “https://registry-1.docker.io/v2/”: proxyconnect tcp: dial tcp 192.168.1.1:7890: connect: no route to host
解决方法:
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/proxy.conf
在proxy.conf文件中加入:
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:7890"
Environment="HTTPS_PROXY=http://127.0.0.1:7890"
随后在终端执行:
export http_proxy="http://127.0.0.1:7890"
export https_proxy=$http_proxy
sudo systemctl daemon-reload
sudo systemctl restart docker
随后挂clash即可正常docker pull