-2

we know that Docker on Windows runs a virtual machine in the background so that may seem like you are able to run Linux Containers on Windows, but behind the scenes Docker for Windows is actually just spinning up a whole Linux VM (basically) and putting your containers on top of that VMs Kernel.

so why we still have a concept of "Windows Containers" in the Docker Desktop where you can "switch to Windows Containers"? or the sole purpose of "Windows Containers" is just to allow you to use some Windows utilities, and Docker Desktop will translate the dockerfile from "windows version" to "linux version" e.g a bat instruction in the dockerfile will be replaced by sh?

1
  • Windows containers are for running Windows Server workloads. Not everything can run on Linux. Docker cannot automatically translate between Windows and Linux, but it can support both these distinct technologies using a similar interface.
    – amon
    Apr 2 at 6:45

1 Answer 1

1

Containers share the host OS. So you can't run linux containers in windows or windows containers in linux without cheating.

I guess the answer to the question is, do you think cheating is bad if it works?

We have Windows and Linux containers that work regardless of the Host OS because it's convenient to be able to spin them up without worrying about the details.

3
  • if windows has to use a Linux VM anyway, why not just get rid of the concept of Windows containers? Apr 2 at 0:34
  • @user22155685, what about containers that contain applications that only exist for Windows? Apr 2 at 6:37
  • windows can run windows containers without a VM
    – Ewan
    Apr 2 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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