简体   繁体   中英

Docker image isn't building: Linux container

I am trying to dockerize a simple dotnetcore webapi on linux container on a windows 10 machine and whenever i build the dockerfile i get this error:

c:\\docker-tutrial>docker build -t docker-tutorial .

Sending build context to Docker daemon 1.364MB

Step 1/4 : FROM microsoft/dotnet:2.1 Get https://registry-1.docker.io/v2/ : net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

I tried:

c:\\docker-tutrial>docker build --build -arg http_proxy= http://PROXY:8080 --build -arg https_proxy= http://PROXY:8080 -t docker-tutrial .

Get https://registry-1.docker.io/v2/ : net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

My Dockerfile is:

FROM microsoft/dotnet:2.1
WORKDIR /app
COPY ./publish .
ENTRYPOINT ["dotnet", "docker-tutrial.dll"]

I believe it is a proxy issue anyideas!!

It happened the same thing to me, after following various github issues I found out that the best way to overcome this problem is based on pure luck after doing these 4 steps:

  1. Put 8.8.8.8 and 8.8.4.4 as Docker DNS
  2. Restart Docker Service
  3. If you behind any firewall/proxy make sure to update those settings too.
  4. Restart your computer.

These 4 steps usually solve the problem to me.

It worked after I fixed the command as greyhame mentioned: docker build --build -arg http_proxy= http://PROXY:8080 --build -arg https_proxy= https://PROXY:port -t docker-tutrial .

And i passed those two lines in the Dockerfile: ENV HTTP_PROXY "PROXY:PORT" ENV HTTPS_PROXY "PROXY:PORT"

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