Comment by treve

11 hours ago

On Windows, doesn't this technically mean OP is running Linux inside a Linux VM inside Windows? From what I understand Docker is Linux tech and to use it anywhere else a (small) Linux VM is required. If true, I would just dispense with the extra layer and just run a Linux VM. Not to discourage experimentation though!

Almost.

For one thing, Docker is not really "Linux inside Linux". It uses Linux kernel features to isolate the processes inside a container from those outside. But there is only one Linux kernel which is shared by both the container and its host (within the Linux VM, in this case).

For another, running Linux containers in a Linux VM on Windows is one (common) way that Docker can work. But it also supports running Windows containers on Windows, and in that case, the Windows kernel is shared just like in the Linux case. So Docker is not exactly "Linux tech".

  • I think GP is likely referring to Docker Desktop, which is probably the most common way to use Docker on Windows.

    Running Linux containers using Docker Desktop has a small Linux VM in which the containers are run and then Docker does some mucking about to integrate that better with the Windows host OS.

  • I thought docker only supports windows as a host if you enable wsl, in which case you're running on hyper v and Linux kernel as part of wsl2, so absolutely Linux tech on a Linux vm on Windows... Am I wrong?

    • You are. Docker Desktop supports two different container platforms: usual Linux ones and Windows Containers.

      With the former a Linux kernel is required. You have two options: using WSL2 and benefiting from all the optimizations and integrations that Microsoft made, or running a full Hyper-V VM that gives absolute control and isolation from rest of the system.

      For the latter, you need a Pro license and need to enable Containers feature (deployment requires more expensive Server licenses). Then you can run slimmed down Windows images like "nano server" which doesn't have GUI APIs.

    • Docker supports either hyper-v, or wsl2 as a host for the Linux kernel - they generally push people towards wsl2. I vaguely recall wsl2 uses a subset of hyper-v the name of which escapes me atm.

Isn’t this the case on macOS too?

I desperately wish I could run docker properly (CLI) on the Mac rather than use docker desktop, and while we are making a dream list, can I just run Ubuntu on the Mac mini?

No, WSL2 does not run "inside Windows", but on the "Virtual Machine Platform", a sort of mini hyper-v.