0

I have the following issue. I'm using Windows 10 version 21H1. First I installed Docker desktop, but when I ran it (as Windows container) I ran into hyper-v issues. So finally I followed the steps here: https://poweruser.blog/docker-on-windows-10-without-hyper-v-a529897ed1cc

That helped me at least have a running docker daemon.

Now I'm trying to create a Docker container where I can run .NET (.exe) applications and I can't seem to manage that. First I tried to find a Docker image that corresponds to my local Windows, based on this: https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility?tabs=windows-server-20H2%2Cwindows-10-21H1

However, having

FROM mcr.microsoft.com/windows/nanoserver:win10-21h1-preview

in my Dockerfile resulted in an error when I ran the Docker image/container:

docker: Error response from daemon: hcs::CreateComputeSystem bb65c4f05b41cb637f2e6cda7a6201aa5af8f51659b299957be0e45eb3e5dab9: The container operating system does not match the host operating system.

The only thing that worked was:

FROM mcr.microsoft.com/windows/nanoserver:2004

but with this image I don't seem to have any tools to run a .NET application; I don't even have the powershell.

So in short, what's the way to run a .NET exe inside a Docker container on Windows 10 ?

Thanks,

Greetings,

Sorin

1 Answer 1

1

There are official .NET Docker images for Windows that you should be using since you're specifically wanting to run a .NET application. For example, you can run the .NET 5 SDK using the following tag: mcr.microsoft.com/dotnet/sdk:5.0. There are also sample .NET Docker images that demonstrate a pre-made .NET application: mcr.microsoft.com/dotnet/samples:dotnetapp.

These are all multi-arch/multi-platform tags, meaning that an appropriate version of the Windows image will be pulled based on the version of your host machine. So there's no need to worry about using a specific tag for your version of Windows. However, there are Windows version-specific tags available as well in cases where that's necessary (e.g. 5.0-nanoserver-20H2).

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

1 Comment

thank you Matt, but with mcr.microsoft.com/dotnet/samples:dotnetapp as well as with mcr.microsoft.com/dotnet/sdk:5.0, when I try to run the docker container produced from these images, I'm getting this error: docker: Error response from daemon: hcs::CreateComputeSystem c0fa747600588d1be9a603577e70db03d9bafd00883bdb294ece6b2bf9bf4eb4: The container operating system does not match the host operating system.

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.