I have the following dockerfile for Windows, which fails to install node.js because msiexec is not a recognized command...
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
#####################################################
# I NEED NODE.JS WITHIN THE SAME LAYER AS DOTNET SDK.
RUN curl -o nodejs.msi https://nodejs.org/dist/v14.16.0/node-v14.16.0-x86.msi
RUN msiexec /i nodejs.msi /quiet /qn /norestart
#####################################################
WORKDIR /src
COPY ["NetWithAngular/NetWithAngular.csproj", "NetWithAngular/"]
RUN dotnet restore "NetWithAngular/NetWithAngular.csproj"
COPY . .
WORKDIR "/src/NetWithAngular"
RUN dotnet build "NetWithAngular.csproj" -c Release -o /app/build
# ...the rest I've skipped...
'msiexec' is not recognized as an internal or external command, operable program or batch file.
What is the problem here? Why is this not working? I also discovered that a similar attempt to use powershell gets the exact same error. So this is a Windows image without msiexec and powershell? Huh? Anyway...
Adding another "stage" in the dockerfile, which already has node.js, is not the solution I need. This is because the dotnet NetWithAngular.csproj build is integrated with an Angular SPA and kicks-off "npm build". In other words, I need the dotnet sdk and node / npm in the same layer.
How do I install node.js, when msiexec is not availabe? For that matter, how on earth is msiexec and powershell not available?
Update
I have discovered that I can circumvent this problem if I change the base image to:
FROM mcr.microsoft.com/dotnet/sdk:6.0-windowsservercore-ltsc2022
With this image, both msiexec and powershell work. However, this doesn't fully answer my question. Why is neither msiexec nor powershell available with the original base image? Indeed, someone in the comments says that they have successfully executed msiexec using the exact same base image.