Cowborg
Cowborg

Reputation: 2871

RUNnning Powershell commands in Docker image fails

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

Upvotes: 2

Views: 2715

Answers (1)

Cowborg
Cowborg

Reputation: 2871

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/

Upvotes: 2

Related Questions