Reputation: 12510
I am trying to install vcpkg
but I fail to understand my error. I did follow instructions from here.
Here is the minimal steps to reproduce the issue:
> docker build .
Sending build context to Docker daemon 2.048kB
Step 1/7 : FROM mcr.microsoft.com/dotnet/sdk:7.0
---> 43067ec72d68
Step 2/7 : WORKDIR C:/dev/
---> Running in 44765abf2793
Removing intermediate container 44765abf2793
---> 863d49ebd1c4
Step 3/7 : ARG VCPKG_VERSION=2023.07.21
---> Running in 2c95eca3b986
Removing intermediate container 2c95eca3b986
---> 1b6f0b11bef4
Step 4/7 : ADD https://github.com/microsoft/vcpkg/archive/refs/tags/$VCPKG_VERSION.zip C:\TEMP\vcpkg.zip
Downloading 7.571MB
---> c957800f783c
Step 5/7 : RUN tar -xf C:\TEMP\vcpkg.zip && ren vcpkg-%VCPKG_VERSION% vcpkg && del /f /q c:\TEMP\*.*;
---> Running in e2d020f011a6
Removing intermediate container e2d020f011a6
---> d5511b253da3
Step 6/7 : SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
---> Running in 2c4d887da6a1
Removing intermediate container 2c4d887da6a1
---> 14b149981886
Step 7/7 : RUN .\vcpkg\bootstrap-vcpkg.bat -disableMetrics;
---> Running in 31e9ab80d53d
'powershell.exe' is not recognized as an internal or external command,
operable program or batch file.
What should I do about this pwsh.exe
vs powershell.exe
?
Where:
> cat Dockerfile
# escape=`
FROM mcr.microsoft.com/dotnet/sdk:7.0
WORKDIR C:/dev/
ARG VCPKG_VERSION=2023.07.21
ADD https://github.com/microsoft/vcpkg/archive/refs/tags/$VCPKG_VERSION.zip C:\TEMP\vcpkg.zip
RUN tar -xf C:\TEMP\vcpkg.zip `
&& ren vcpkg-%VCPKG_VERSION% vcpkg `
&& del /f /q c:\TEMP\*.*;
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN .\vcpkg\bootstrap-vcpkg.bat -disableMetrics;
For reference:
> docker run --rm mcr.microsoft.com/dotnet/sdk:7.0 pwsh --version
PowerShell 7.3.10
while:
> docker run --rm mcr.microsoft.com/dotnet/sdk:7.0 powershell --version
docker: Error response from daemon: container 615360a3654bbe128045fa96770d163dc6c9079b9e86e6d42357eb9e6ee6d10e encountered an error during hcs::System::CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2)
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(173)\vmcomputeagent.exe!00007FF606A8A1DB: (caller: 00007FF606A3E19A) Exception(1) tid(390) 80070002 The system cannot find the file specified.
CallContext:[\Bridge_ProcessMessage\VmHostedContainer_ExecuteProcess]
Provider: 00000000-0000-0000-0000-000000000000].
And batch file is:
Upvotes: 0
Views: 246
Reputation: 12510
Seems overly complex to do a simple task. Here is what I got when not changing the default SHELL
:
# escape=`
FROM mcr.microsoft.com/dotnet/sdk:7.0
# Cannot update path, need hackish solution:
# https://github.com/PowerShell/PowerShell-Docker/issues/236
ENV PATH="C:\Windows\system32;C:\Program Files\dotnet;C:\Program Files\powershell;C:\Program Files\MinGit\cmd;C:\dev\vcpkg"
ARG VCPKG_VERSION=2023.07.21
# https://github.com/microsoft/vcpkg/blob/2023.07.21/scripts/bootstrap.ps1
# Naming convention taken from recent https://github.com/microsoft/vcpkg/blob/2023.11.20/scripts/bootstrap.ps1
ARG VCPKG_TOOL_RELEASE_TAG=2023-07-19
WORKDIR C:/dev/
RUN `
pwsh -command "Invoke-WebRequest -OutFile C:\dev\vcpkg.zip https://github.com/microsoft/vcpkg/archive/refs/tags/%VCPKG_VERSION%.zip" `
# Extract:
&& tar -xf C:\dev\vcpkg.zip `
&& del /q c:\dev\vcpkg.zip `
# Remove version from folder name:
&& ren vcpkg-%VCPKG_VERSION% vcpkg `
# Cannot use the default `curl` does not seems to download anything (302 issue?)
# && curl -o vcpkg/vcpkg.exe https://github.com/microsoft/vcpkg-tool/releases/download/%VCPKG_TOOL_RELEASE_TAG%/vcpkg.exe
# Same goes for the tool `tls12-download.exe` seems to be missing a dll ?
# Use Invoke-WebRequest instead:
&& pwsh -command "Invoke-WebRequest -OutFile vcpkg/vcpkg.exe https://github.com/microsoft/vcpkg-tool/releases/download/%VCPKG_TOOL_RELEASE_TAG%/vcpkg.exe";
Quick check:
> docker build -t vcpkg-test .
> docker run --rm vcpkg-test vcpkg --version
vcpkg package management program version 2023-07-19-814b7ec837b59f1c8778f72351c1dd7605983cd2
See LICENSE.txt for license information.
Posted as issue:
Upvotes: 0