Windows docker build 警告非 windows docker 主机
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46080312/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Windows docker build warning non-windows docker host
提问by Guillaume
I am trying to build a docker image from a docker client (Windows) running this command:
我正在尝试从运行此命令的 docker 客户端(Windows)构建一个 docker 镜像:
docker --host a.b.c.d build --no-cache=true --build-arg CONFIGURATION=live -t imagename .
The docker host is also a Windows Docker but I get this error:
docker 主机也是 Windows Docker,但我收到此错误:
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
安全警告:您正在针对非 Windows Docker 主机从 Windows 构建 Docker 映像。添加到构建上下文的所有文件和目录都将具有“-rwxr-xr-x”权限。建议仔细检查并重置敏感文件和目录的权限。
And then this one after the first attempt:
然后是第一次尝试后的这个:
invalid character '<' looking for beginning of value
寻找值开头的无效字符“<”
Anyone know why this happen? I had no error before, the only differences are in the code source. For information I am using Jenkins to build the project? Thanks.
有谁知道为什么会这样?我之前没有错误,唯一的区别在于代码源。有关信息,我正在使用 Jenkins 构建项目?谢谢。
UPDATE 1 - Dockerfile
更新 1 - Dockerfile
FROM microsoft/windowsservercore
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
ARG CONFIGURATION
EXPOSE 80
ADD src/MyFolder/bin/$CONFIGURATION/ /ContainerFolder
CMD /ContainerFolder/MyApp.exe
回答by Francesco Borzi
From thaJeztah on GitHub:
That warning was added, because the Windows filesystem does not have an option to mark a file as 'executable'. Building a linux image from a Windows machine would therefore break the image if a file has to be marked executable.
For that reason, files are marked executable by default when building from a windows client; the warning is there so that you are notified of that, and (if needed), modify the Dockerfile to change/remove the executable bit afterwards.
添加了该警告,因为 Windows 文件系统没有将文件标记为“可执行文件”的选项。因此,如果必须将文件标记为可执行文件,则从 Windows 机器构建 linux 映像会破坏映像。
因此,从 Windows 客户端构建文件时,默认情况下将文件标记为可执行文件;警告在那里,以便您收到通知,并且(如果需要)修改 Dockerfile 以在之后更改/删除可执行位。
回答by Guillaume
This is fixed now. The problem was in the Gateway Firewall, it was detecting a file sent in the build context as a Trojan. Probably Docker build context zip file or use different extensions.
现在已修复。问题出在网关防火墙中,它检测到在构建上下文中发送的文件是木马。可能 Docker 构建上下文 zip 文件或使用不同的扩展。