我的Docker映像来自已安装mcr.microsoft.com/powershell:latest
的powershell
。为什么在构建docker映像时出现此错误:/bin/sh: 1: Install-Module: not found
下面是我的dockerfile:
FROM mcr.microsoft.com/powershell:latest
RUN Install-Module dbatools -Force
当我从Install-Module dbatools -Force
手动启动容器时,可以运行命令mcr.microsoft.com/powershell:latest
。为什么不能通过构建映像来运行它?是否有不同的背景?如果它使用本地主机上下文,是否意味着我需要在Mac OS上安装powershell
?
如果我想以ENTRYPOINT的身份运行Powershell脚本,如何指定它?
您可以在SHELL
中使用Dockerfile
指令:
SHELL ["powershell","-command"]
RUN New-Item -ItemType Directory C:\Example
查看更多here