问题
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 waiting for connection (Client.Timeout exceeded while awaiting headers)
回答1:
I was facing the same issue when trying to build or pull an image with Docker on Win10. Changing the DNS of the Docker vEthernet(DockerNAT)
network adapter to 8.8.8.8
fixed it for me, as described in this GitHub issue.
To change the DNS go to Docker (TrayIcon) -> Settings -> Network and set a fixed DNS server ip = 8.8.8.8
.
Changing the DNS server in the configuration of the windows network adapter worked too.
After restarting Docker is able to pull and build images again.
Version Info:
Windows 10 x64 Enterprise Version 1709
$ docker version
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:05:22 2017
OS/Arch: windows/amd64
Server:
Engine:
Version: 17.12.0-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:12:29 2017
OS/Arch: linux/amd64
Experimental: true
回答2:
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
回答3:
I had the same issue and only found out after 30 minutes that I was on a VPN network for work which blocks other sites. I went off the VPN, and it worked :) This is definitely a network issue. When it said "not authenticated", I thought perhaps I needed some login credentials or so.
回答4:
I had the same problem and the following fix has worked for me: https://github.com/moby/moby/issues/22635#issuecomment-260063252
In my case I've added the following 2 "nameserver" lines to /etc/resolv.conf file.
before:
nameserver 127.0.0.53
after:
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 127.0.0.53
回答5:
This may be the old one, but fixed available here
https://success.docker.com/article/i-get-x509-certificate-signed-by-unknown-authority-error-when-i-try-to-login-to-my-dtr-with-default-certificates run following commands on each server
export DOMAIN_NAME=bootstrap.node1.local export TCP_PORT=5000 openssl s_client -connect $DOMAIN_NAME:$TCP_PORT -showcerts /dev/null | openssl x509 -outform PEM | tee /etc/pki/ca-trust/source/anchors/$DOMAIN_NAME.crt update-ca-trust /bin/systemctl restart docker.service
回答6:
For my case, my company needed to define my IP in the White list in order to access the cloud.docker files. So do not hesitate to tell the responsible person if you have such error.
回答7:
+1 , it worked for me, however you also need to make sure that proxy settings are disabled if u are public internet or set proxies if u are on corporate network
回答8:
I face this problem when performing Ansible AWX installation.
I had my own private DNS :192.168.0.254 & 192.168.0.253 but was receiving same error.
Issue got resolved after change my DNS back to 8.8.8.8 & 8.8.4.4.
回答9:
I have same issue with registry deployed in swarm. Restart docker helps but after some time it occurs again.
Redeploy registry with docker-compose
sudo docker-compose up -d
and all works fine
来源:https://stackoverflow.com/questions/48056365/error-get-https-registry-1-docker-io-v2-net-http-request-canceled-while-b