0

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!!

Marvin
  • 1,650
  • 4
  • 19
  • 41
Salah
  • 173
  • 3
  • 17
  • See this https://learn.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/configure-docker-daemon#proxy-configuration – Tarun Lalwani Jun 26 '18 at 12:40
  • Thanks but It didn't work. but i already have Variable there: http_proxy http://proxy.com:port https_proxy http://proxy.com:port – Salah Jun 26 '18 at 13:05

2 Answers2

0

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.

greyhame
  • 264
  • 2
  • 13
  • Thanks, but it didn't work, because if i change my DNS internet won't work due to the network structure in the organization. – Salah Jun 28 '18 at 07:14
  • Oh, too bad! I've noticed another little thing: You tried: `docker build --build -arg http_proxy=http://PROXY:8080 --build -arg https_proxy=http://PROXY:8080 -t docker-tutrial . ` Notice that you used "https_proxy" and you put an'http address, maybe that's the issue? – greyhame Jun 28 '18 at 07:39
  • Yes, correct i fixed that issue and i passed ENV HTTP_PROXY "http://PROXY:PORT" ENV HTTPS_PROXY "https://PROXY:PORT" in the docker file and it worked. – Salah Jun 28 '18 at 14:00
  • Happy if I could help :) – greyhame Jun 28 '18 at 14:03
0

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"

Salah
  • 173
  • 3
  • 17