Azure Pipelines 构建失败,并显示“守护程序的错误响应:容器 <id> 未运行”

Mak*_*toE 5 azure-pipelines

我的 Azure Pipelines 构建在 CmdLine 阶段失败Error response from daemon: Container 6c04267ea73602db828802df820c5c33cf95223ad0dcd0e3ef73b545d51f3bfa is not running

我的azure-pipelines.yml是:

pool:
  vmImage: windows-2019
container: my-docker-container

steps:
  - script: |
      echo 'run build script'
Run Code Online (Sandbox Code Playgroud)

forDockerfilemy-docker-container

FROM mcr.microsoft.com/windows/servercore:1809
# Do stuff
ENTRYPOINT ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
Run Code Online (Sandbox Code Playgroud)

我需要修复什么才能解决此错误?

Mak*_*toE 1

ENTRYPOINT [...]从 中删除该行Dockerfile。构建管道需要ENTRYPOINTcmd.exe;我不知道为什么。

您可以包含SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]在其中Dockerfile,并且不会影响构建。

要在管道中运行 Powershell 脚本,请更改- script- powershell.