Search code examples
dockercmdproxy.net-corelinux-containers

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


Solution

  • 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"