Closed yanrunming closed 1 month ago
This issue is known, the official image mcr.microsoft.com/dotnet/framework/runtime:4.7.2-windowsservercore-ltsc2019 is not released for newer Windows 10 OS versions. You can try syngopredevelopmentimages.azurecr.io/dotnetframework:base, which is older but should also work .NET Framework processes. Better is to create windows container which uses the nano server image as base, it's only around 100MB: https://hub.docker.com/r/microsoft/windows-nanoserver
Example for that in K2s: https://github.com/Siemens-Healthineers/K2s/blob/main/k2s/test/e2e/addons/storage/smb/diskwriter/Dockerfile or https://github.com/Siemens-Healthineers/K2s/tree/main/k2s/test/e2e/addons/generic/build_image/weather-win
If it's OK for you, I would close this issue.
I tested the base and still got some error.
FROM mcr.microsoft.com/windows/nanoserver:20H2
COPY bin/Debug/ .
CMD ["ConsoleApp1.exe"]
For dotnetframework you need a dotnetframework base image like we have syngopredevelopmentimages.azurecr.io/dotnetframework:base. I can give you the token to access it. Or you check these examples: https://github.com/microsoft/dotnet-framework-docker/blob/main/samples/README.md
Better you do it on Windows 11 with mcr.microsoft.com/dotnet/framework/runtime:4.8.1, on Windows 10 you need to use our base image because MS stopped to provide support after 20H2.
Else please checkout the samples from K2s with golang: https://github.com/Siemens-Healthineers/K2s/blob/main/k2s/test/e2e/addons/storage/smb/diskwriter/Dockerfile or https://github.com/Siemens-Healthineers/K2s/tree/main/k2s/test/e2e/addons/generic/build_image/weather-win
Also in containers never use debug executables always release images because of dependencies !
Hi dieter, you are so kind. Thanks for your reminder. I didn't expect that It was a compatibility issue. Due to my host is win10 22h2(build no 19045), I should choose the 20H2 (19042) base image. And the nanoserver doesn't support the old net framework. So servercore:20H2 does work.
FROM mcr.microsoft.com/windows/servercore:20H2
WORKDIR /app
COPY ndp48.exe .
RUN ndp48.exe /q /norestart /log C:/dotnet48_install.log
COPY bin/Release/ .
CMD ["ConsoleApp2.exe"]
According to the official building guide (https://siemens-healthineers.github.io/K2s/latest/user-guide/building-container-image/#building-a-windows-container-image), I built a container image and failed to deploy it to the win10 node.
My steps:
Set up environment variables
ENV DOTNET_RUNNING_IN_CONTAINER=true
Set the working directory
WORKDIR /app
Copy the application files to the container
COPY bin/Debug/ .
Specify the command to run your application
CMD ["ConsoleApp1.exe"]
Thanks!