发现镜像失效了,docker pull一直下载不下来,记录一下解决方案

参考https://docs.docker.com/config/daemon/systemd/#httphttps-proxy

  1. 新建文件夹

    sudo mkdir -p /etc/systemd/system/docker.service.d

  2. 创建文件/etc/systemd/system/docker.service.d/http-proxy.conf

    将文中的http://proxy.example.com:3128 替换为自己的代理,如clash-> http://ip:7890

    [Service]
    Environment="HTTP_PROXY=http://ip:7890"
    Environment="HTTPS_PROXY=http://ip:7890"

  3. 刷新重启docker

    sudo systemctl daemon-reload
    sudo systemctl restart docker

  4. 测试是否成功

    sudo systemctl show --property=Environment docker