1

I have read (and seen several online videos) that Linux containers can’t be run on windows and visa versa. It is my understanding that this is due to the fact that the container doesn’t contain a kernel and therefore it relies on the host kernel.

But if I have a simple app like a python hello world, what prevents this from running on both operating systems?

1

But if I have a simple app like a python hello world, what prevents this from running on both operating systems?

It won't work in the same way that copying /usr/bin/python from a Linux machine to a Windows machine and using it to run your application doesn't work.

Docker isn't running the hello world script, it's running Python, which needs to be compiled for specific operating systems and architectures.

0

You can run your Docker containers on all major platforms, but Docker on Windows and Mac runs your containers on a Linux VM.

It takes care of mapping volumes, ports etc. from your host machine to containers, so mostly you don't have to think about the VM layer. But you still have configure limits of VM resources (RAM, CPU etc.) and there might be adverse effects on performance.

I don't think you can run Linux-based Docker containers on a Windows machine directly without a VM (not taking WSL into account) as even a simple "hello world" app would use a Linux base image with Linux binaries, which cannot be run on a Windows machine without some kind of emulation or virtualization.

See: https://docs.docker.com/docker-for-windows

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.