Error “Get https://registry-1.docker.io/v2/: net/http: request canceled” while building image

后端 未结 11 1121
攒了一身酷
攒了一身酷 2020-12-13 19:01

I am getting the below error while building an image

Step 1/10 : FROM ubuntu:14.04
Get https://registry-1.docker.io/v2/: net/http: request canceled while wai         


        
11条回答
  •  轮回少年
    2020-12-13 19:28

    I think the issue is that you are behind the proxy which in which case you need to write make manual configuration in Docker systemd service file. That will overrides the default docker.service file.

    If you are using Docker for Windows then simply set the default DNS to 8.8.8.8 on the "vEthernet (DockerNAT)" network adapter. But, remember this is not best practice as you will be exposing from your office network.

    In linux environment, you could add the environment variable as you are behind HTTP_PROXY or HTTPS_PROXY, as you are using port 80 or 443 respectively. As shown below in /etc/systemd/system/docker.service.d/http-proxy.conf

    [Service]
    Environment="HTTP_PROXY=http://proxy.example.com:80/"
    

    as for HTTTP_PROXY in /etc/systemd/system/docker.service.d/https-proxy.conf

    [Service]
    Environment="HTTPS_PROXY=https://proxy.example.com:443/"
    

    Then just restart docker after deamon reload,

     $ sudo systemctl daemon-reload
     $ sudo systemctl restart docker
    

    Hope this works.

    Reference: https://docs.docker.com/engine/admin/systemd/#httphttps-proxy

提交回复
热议问题