Running Linux container in windows

I’m new to this container stuff, I understand that I unlike VMs containers don’t have operating systems in it.

But what if I build a container image under the Linux operating system and then I want to run this container image in Windows machine. How is that going to happen?

from my understanding in a container image there will only be your code and libraries. When switching between different operating systems I thought it would crash at the beginning.

can someone please correct me, really appreciate your help thank you


  • It's not really that complicated. For example, when you use Docker Desktop for Windows, you can choose between using Windows containers or Linux containers. If you choose to run Linux containers on Windows, there are a couple of things happen in the background, but, Docker Desktopdoes that for you:

    • Hyper-V supervisor need to be enabled on the windows machine
    • Then an Hyper-V Linux image is downloaded
    • That machine is started on Hyper-V and works as the new host for your Linux containers

    So with that in place, when you build or run new docker images, all those instructions and commands run on that Linux virtual machine.

    Also, the containers have an operative system but a really simple one, that's why they are so lightweight, if you need anything else that the base image doesn't have (maybe a system call or something), that container can use the host kernel to run those instructions(the host share the kernel with the running containers). It's a really good way to start with docker, to know how it works internally.

    This might help to explain how it works: enter image description here