繁体   English   中英

在 Windows 2019 服务器上的 docker build 中运行 powershell 失败

[英]RUN powershell failing in docker build on windows 2019 server

我在 Windows 2019 服务器上运行。

每当我从 docker build 上的 dockerfile 调用 powershell 时,我都会收到错误消息是..

---> 在 6efa29aa8a4a 中运行命令“powershell -Command DIR”返回非零代码:3221226505

Dockerfile..

# escape=` (backtick)
FROM mcr.microsoft.com/windows/servercore:ltsc2019
RUN DIR

RUN ["powershell", "-Command", "DIR"]

COPY ./ app/
WORKDIR app
CMD [ "someapp", "somearg" ]

我曾尝试通过 powershell 替换 cmd

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

RUN DIR

结果是一样的。

谢谢

尝试运行更像的 dockerfile

从 mcr.microsoft.com/windows/servercore/iis

运行 powershell -NoProfile -Command Remove-Item -Recurse C:\\inetpub\\wwwroot*

工作目录 /inetpub/wwwroot

复制 。 /inetpub/wwwroot

也许你必须在 WORKDIR 之后移动你的 COPY 命令? 尝试不同的东西

检查以确保您的构建机器(和主机)上安装了更新 KB4532691。 ltsc2019 (20/2020) 的最新图像没有它就会出现问题。

请参阅https://hub.docker.com/_/microsoft-windows-servercorehttps://support.microsoft.com/en-us/help/4542617/you-might-encounter-issues-when-using-windows -server-containers-with-t了解更多信息

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM