Skip to content

Cannot set ErrorActionPreference "$ErrorActionPreference = 'Stop'" in run when deriving from sdk:4.8-windowsservercore-ltsc2019 #298

@ggirard07

Description

@ggirard07

I am trying to use the samples from Microsoft doc best practices, but with the framework sdk base image instead. The docker build is successful but a powershell error is always outputted:

Stop : The term 'Stop' is not recognized as the name of a cmdlet, function, 
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ Stop = Stop
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (Stop:String) [], CommandNotFoun
   dException
    + FullyQualifiedErrorId : CommandNotFoundException

When using the default image from the example (mcr.microsoft.com/windows/servercore:ltsc2019), I do not have any error outputted to the logs of the docker build command.

Here is the content of the Dockerfile producing the described behavior:

FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019

RUN powershell.exe -Command \
  $ErrorActionPreference = 'Continue'; \
  Invoke-WebRequest https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe -OutFile c:\python-3.5.1.exe ; \
  Start-Process c:\python-3.5.1.exe -ArgumentList '/quiet InstallAllUsers=1 PrependPath=1' -Wait ; \
  Remove-Item c:\python-3.5.1.exe -Force

And the command used for the docker build:

docker build --rm -f "Dockerfile" -t test:latest .

I am using Docker Desktop 2.0.0.3 in Windows container mode (without experimental features) on Windows 10 Pro 1903 (Build 18362.116).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions