2

I have this in my Dockerfile.

FROM microsoft/dotnet:2.1-sdk-nanoserver-1803 AS build
WORKDIR /src 
...
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Write-Output  'hello from ps' 

I run docker build and get to this point in my dockerfile, then I get the error message below.

Step 8/24 : RUN Write-Output 'hello' ---> Running in ea5d79c5698c container ea5d7....5cb94f67 encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(174)\vmcomputeagent.exe!00007FF738A6C00A: (caller: 00007FF738A3ECEA) Exception(2) tid(36c) 80070002 The system cannot find the file specified.

EDITS/UPDATES It seems that

  • microsoft/aspnetcore-build does not support .net core 2.1 (but has both powershell and node installed)
  • microsoft/dotnet:2.1-sdk is meant for building, but missing both powershell and node
  • Same goes for microsoft/dotnet:2.1-sdk-nanoserver-1803
1
  • 1
    Basically, the nanoserver image don't have powershell by default. You can use cmd instead, as answered by yourself bellow, or use the servercore as base image, or still install the powershell manually in your Dockerfile. Commented Aug 24, 2022 at 10:36

1 Answer 1

2

Use curl instead

RUN curl.exe -o node.zip https://nodejs.org/dist/v9.2.0/node-v9.2.0-win-x64.zip && \
  mkdir "C:\\Program Files\\node" && \
  tar.exe -xf node.zip -C "C:\\Program Files\\node" --strip-components=1

https://blogs.technet.microsoft.com/virtualization/2017/12/19/tar-and-curl-come-to-windows/

Sign up to request clarification or add additional context in comments.

1 Comment

Your link has expired. Here's an archived version web.archive.org/web/20180307190307/https://…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.