Reputation: 11304
I have to following (simple) Dockerfile:
FROM microsoft/windowsservercore:latest
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENTRYPOINT ["Get-ChildItem ", "-Path", "'C:\Program Files\'"]
If I run the container. I get the following error:
At line:1 char:77 + ... ference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; ["Get-Chi ... + ~ Missing type name after '['. At line:1 char:93 + ... $ProgressPreference = 'SilentlyContinue'; ["Get-ChildItem ", "-Path" ... + ~ Missing argument in parameter list. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordEx ception + FullyQualifiedErrorId : MissingTypename
I also tried:
ENTRYPOINT ["Get-ChildItem ", "-Path 'C:\Program Files\'"]
and got the same error.
If I use the shell form the ENTRYPOINT in the Dockerfile:
FROM microsoft/windowsservercore:latest
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENTRYPOINT Get-ChildItem -Path 'C:\Program Files\'
Everything works fine.
Can somebody tell me how to write this simple PS command in the "exec-form" when using ENTRYPOINT. I'm asking since the docker reference states that the "exec-form" is the preferred one.
Thx
Upvotes: 1
Views: 2405
Reputation: 156
Try removing the trailing space at the end of "Get-ChildItem "
Failing that, is it interpreting \' after Program Files as an escaped character ?
Upvotes: 1