简体   繁体   中英

Why does FROM registry.hub.docker.com/library/centos:centos7 fail in my docker build?

The following line in my Dockerfile :

FROM registry.hub.docker.com/library/centos:centos7

fails with the following error:

Sending build context to Docker daemon  1.664MB
Step 1/17 : FROM registry.hub.docker.com/library/centos:centos7
Get https://registry.hub.docker.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

I am running behind a proxy and I tried to follow the instructions on this website , but still no success (same error). So I have a file in my ~/.docker/config.json that pretty much looks like what the link says, and I inserted my internal proxy IP address information. However, I still get the same "request canceled" error message shown above.

Here is some information about my CentOS 7 system:

Linux localhost.localdomain 3.10.0-1160.15.2.el7.x86_64 #1 SMP Wed Feb 3 15:06:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

docker version
Client: Docker Engine - Community
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:33:55 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:32:17 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0

As richyen said, the correct image is centos:7 and should make it work.

You are speaking about a proxy: the method you used to set a proxy up works, but if your system uses systemd (which is centos7 case I think) you should use this method to set your docker proxy up. I had a lot of troubles with that in the past.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM