我的 docker 映像来自已安装powershell
mcr.microsoft.com/powershell:latest
。为什么在构建 docker 映像时出现此错误:/bin/sh: 1: Install-Module: not found
下面是我的码头文件:
FROM mcr.microsoft.com/powershell:latest
RUN Install-Module dbatools -Force
我可以在从mcr.microsoft.com/powershell:latest
手动启动容器时Install-Module dbatools -Force
运行命令。为什么我无法从构建映像中运行它?它有不同的背景吗?如果它使用我的本地主机上下文,这是否意味着我需要在我的 Mac OS 上安装powershell
?
如果我想将 powershell 脚本作为入口点运行,如何指定它?
你可以在Dockerfile
中使用SHELL
指令:
escape=`
SHELL ["powershell","-command"]
RUN New-Item -ItemType Directory C:Example
在此处查看更多内容