gpt4 book ai didi

Windows docker build 警告 non-windows docker host

转载 作者:IT老高 更新时间:2023-10-28 12:46:44 25 4
gpt4 key购买 nike

我正在尝试从运行此命令的 docker 客户端 (Windows) 构建 docker 镜像:

docker --host a.b.c.d build --no-cache=true --build-arg CONFIGURATION=live -t imagename .

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.

然后是第一次尝试后的这个:

invalid character '<' looking for beginning of value

有人知道为什么会这样吗?我之前没有错误,唯一的区别在于代码源。有关我正在使用 Jenkins 构建项目的信息?谢谢。

更新 1 - Dockerfile

FROM microsoft/windowsservercore
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]

ARG CONFIGURATION
EXPOSE 80
ADD src/MyFolder/bin/$CONFIGURATION/ /ContainerFolder
CMD /ContainerFolder/MyApp.exe

最佳答案

来自 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 docker build 警告 non-windows docker host,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46080312/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com