• 目录:

    docker 拉不了镜像了 2024-06-06


    apt 使用代理

    apt -o Acquire::http::proxy="http://127.0.0.1:17890/" update
    

    docker pull 使用代理

    要从 systemd 配置。 https://docs.docker.com/config/daemon/proxy/#systemd-unit-file

    mkdir -p /etc/systemd/system/docker.service.d
    vi /etc/systemd/system/docker.service.d/http-proxy.conf
    
    [Service]
    Environment="HTTP_PROXY=http://localhost:17890"
    Environment="HTTPS_PROXY=http://localhost:17890"
    Environment="NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"
    

    重启使配置生效

    systemctl daemon-reload
    systemctl restart docker
    

    查看生效的配置

    systemctl show --property=Environment docker