简体   繁体   English

Docker镜像未构建:Linux容器

[英]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: 我正在尝试在Windows 10计算机上的linux容器上对简单的dotnetcore webapi进行docker化,每当我构建dockerfile时,都会出现此错误:

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

Sending build context to Docker daemon 1.364MB 将构建上下文发送到Docker守护程序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) 步骤1/4:来自microsoft / dotnet:2.1获取https://registry-1.docker.io/v2/:net / http:等待连接时请求被取消(等待头时超出了Client.Timeout)

I tried: 我试过了:

c:\\docker-tutrial>docker build --build -arg http_proxy= http://PROXY:8080 --build -arg https_proxy= http://PROXY:8080 -t docker-tutrial . 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) 获取https://registry-1.docker.io/v2/:net / http:等待连接时请求被取消(等待标头时超过Client.Timeout)

My Dockerfile is: 我的Dockerfile是:

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

I believe it is a proxy issue anyideas!! 我相信这是代理问题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: 在经历了各种github问题之后,我发生了同样的事情,我发现克服此问题的最佳方法是基于完成这4个步骤后的运气:

  1. Put 8.8.8.8 and 8.8.4.4 as Docker DNS 将8.8.8.8和8.8.4.4作为Docker DNS
  2. Restart Docker Service 重新启动Docker服务
  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 . 在我修复了Greyhame提到的命令后,它起作用了: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" 我在Dockerfile中传递了这两行:ENV HTTP_PROXY“ PROXY:PORT” ENV HTTPS_PROXY“ PROXY:PORT”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在高山linux容器内构建docker映像 - Building docker image, inside an alpine linux container 在Alpine Linux Docker容器中构建GNATCOLL - Building GNATCOLL in an Alpine Linux Docker Container 在 docker 容器中挂载 linux 镜像 - Mount linux image in docker container 在Gitlab Runner容器中构建Docker镜像 - Building Docker Image within Gitlab Runner Container 从容器内部构建并推送docker映像 - Building and pushing a docker image from inside a container 用于更改Docker映像并重新创建Docker容器的Ansible工作流? - Ansible workflow for building Docker image and recreating Docker container if image was changed? 在基于Docker的映像更新后,Docker不会在compose中更新服务的容器 - Docker isn't updating the container of a service in compose after image it's based on was updated Debian Packagemanager在构建docker映像时不会在alpine-linux上安装vagrant.deb软件包 - Debian Packagemanager won't install vagrant.deb package on alpine-linux, while building docker image 使用docker-compose在服务器上构建多容器docker映像 - Building multi-container docker image on server with docker-compose Docker不是挂载目录吗? “OCI 运行时创建失败:container_linux.go:346:没有这样的文件或目录:未知” - Docker isn't mounting the directory? "OCI runtime create failed: container_linux.go:346: no such file or directory: unknown"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM