Azure Pipelines build fails with "Error response from daemon: Container <id> is not running"

Viewed 1239

My Azure Pipelines build fails during the CmdLine stage with Error response from daemon: Container 6c04267ea73602db828802df820c5c33cf95223ad0dcd0e3ef73b545d51f3bfa is not running.

My azure-pipelines.yml is:

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

steps:
  - script: |
      echo 'run build script'

And the Dockerfile for my-docker-container is:

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

What do I need to fix to solve this error?

1 Answers

Remove the ENTRYPOINT [...] line from Dockerfile. The build pipeline needs ENTRYPOINT to be cmd.exe; I don't know why.

You can include SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] in Dockerfile and it will not affect the build.

To run Powershell scripts in your pipeline, change - script to - powershell.

Related