7

I am getting the error below while trying to build docker image. My operating system is CentOS 7 on a corporate setting.

Sending build context to Docker daemon  1.22GB
Step 1/20 : FROM centos
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).

I followed the answers i got online.(related question). I followed the answer with the 24 votes, since it is given for CentOS 7

I created a file called docker inside the directory /etc/sysconfig/ and added the content below

HTTP_PROXY="http://proxy.example.com:80/"
HTTPS_PROXY="https://proxy.example.com:443/"
http_proxy="${HTTP_PROXY}"
https_proxy="${HTTPS_PROXY}"

But i am getting the error below.

Sending build context to Docker daemon  1.22GB
Step 1/20 : FROM centos
Get https://registry-1.docker.io/v2/: http: error connecting to proxy https://proxy.example.com:443/: dial tcp: lookup proxy.example.com on 127.0.0.1:53: no such host

My Docker version is

client : 
version 17.05.0-ce
API version:  1.29
server :
version :17.05.0-ce
API version:  1.29
Ben
  • 137
  • 3
  • 12
  • Do you use a proxy at your corporate site? If so, you'll have to use the proxy name itself, not "proxy.example.com". – erik258 Oct 17 '18 at 16:47
  • Is the literal content `proxy.example.com` or are you setting it as a placeholder for a legitimate HTTP proxy that you have? – Zachary Craig Oct 17 '18 at 16:47
  • But the server i am using is **not allowed to connect to internet**. I am using below two commands 1) First i load the image using `docker load -q -i ./centos.tar` 2)second i build the image using `docker build -t "myapp" .` The Dockerfile is in the same directory and it picks it. I also have the centos.tar image in the same directory. Why is the `FROM centos` command trying to connect to internet(registry-1.docker.io/v2). Is there a way i can **build the image without connecting to the internet**, since i have the starting image(centos.tar) locally. – Ben Oct 17 '18 at 19:44
  • Thanks for the answers .I have found the problem. The problem was the base image i have locally(centos.tar) was not tagged with the name 'centos' . So when i build the image, the `FROM centos` command was not getting the base image and goes to internet and fails since the machine doesn't have internet connection. After tagging the local base image, it is building the image using the local base image without going to internet. – Ben Oct 18 '18 at 21:46

0 Answers0