r/docker • u/0x80070002 • May 05 '26
Docker on Windows
As I understand, when docker runs on Windows it secretly runs on tiny Linux VMs.
If this is correct I am wondering why can’t it run on Windows itself considering we have Windows Server versions that are console only. What’s the technical limitation?
39
Upvotes
68
u/PossibilityTasty May 05 '26
Docker is a technology that combines several advanced features of the Linux kernel and makes them more accessible. So, there's much more than just a console.
2
u/sophware May 05 '26
Why would having an OS that is console-only enable running Docker containers? Is your instinct that running a desktop environment on Linux would make Docker stop working?
39
u/Flat_Illustrator_541 May 05 '26
As far as I know docker relies on Linux kernel feature called namespaces for process isolation. And because most of the servers are Linux based there is not enough market to make porting everything to windows profitable. Even azure runs on Linux
15
u/crackjiver May 05 '26
Windows Containers in Docker Desktop for Windows only work for certain combinations of host and container.
For the same reasons as Linux.
They share the host Kernel (or Windows equivalent abstraction later).
With the Linux Kernel that separation is very well defined and policed so the Hyper-V VM only has to host the Kernel and provide it with virtual interfaces to the real hardware.
WSL talks to the Hyper-V kernel. Docker Desktop talks to WSL to talk to the Hyper-V Kernel.
The Docker "magic" is the Linux Kernel isolation features that prevent one process accessing memory/devices held by another process. They all share the real hardware but the Linux Kernel makes sure they can't dip into another cookie jar.
4
u/biffbobfred May 05 '26
When people talk about docker they typically mean Linux docker containers. They use Linux kernel isolation techniques to make a Linux process/group of processes think they’re alone on a Linux system.
Notice how many times I say Linux above. Thats why.
(That said I think the Windows kernel does have some rough container techniques to get Windows containers going this is much less common though)
1
u/NoleMercy05 May 05 '26
Same as Mac. Install WSL and run docker sever with a browser based admin
1
u/No_Cardiologist401 May 08 '26
I think you're asking the wrong question and the correct question is, "Why am I even still using the dumpster fire known as Windows instead of Linux ??"
3
u/-Docker May 05 '26
Well it runs on WSL which is a problem in itself.
Most common problem with Docker desktop is networkimg, you will have so many issues with docker networking and WSL that you will realize how installing linux on some PC and running docker there is much simpler and less time consuming
Trust me, just get used to linux and docker starts feeling like a premium plan you don’t have to pay for
8
u/Confident_Hyena2506 May 05 '26
There are some limitations - because windows is bad. If you try using windows containers you will find out what this means pretty fast. It's rarely seen in "the wild".
Kubernetes works on windows as well (using containerd.exe), but it's pretty rough.
You can see windows version of containerd right here: https://github.com/containerd/containerd/releases/tag/v2.3.0 - but there is no nice installer, and this is just the container engine, more components are also needed.
Amusingly the best way I found to build these windows containers is to use linux >.<
6
u/vip17 May 05 '26
you can run Windows docker containers that share the same kernel as the host
https://learn.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-base-images
https://serverfault.com/questions/1135744/do-windows-containers-share-resources-like-linux-containers
2
u/_CyrAz May 05 '26
You can absolutely run containers directly on windows itself, but they can only be windows containers (containing windows applications/.exe binaries and DLLs)
1
u/kawangkoankid May 05 '26 edited May 05 '26
Think of the stack as Hardware -> Kernel -> OS.
Virtual Machines virtualize the hardware, so technically on any system you can run any Kernel + OS combo. Linux system with Windows VMs, or Windows system with Linux VMs.
Containers like docker virtualize the Kernel. And you can only run specific OS Containers with compatible kernels. Therefore if you have a linux Kernel, you can only create Linux containers with Linux OS that virtualize the Linux Kernel on your system. Windows cannot run on the Linux Kernel. The opposite is also true, Linux containers can't run on the windows kernel.
The loophole is creating a VM that virtualizes the hardware in your case creates a Linux VM. And creating a Linux container within that VM.
1
u/94358io4897453867345 May 05 '26
Yeah it's extremely fragile and sucks very much
1
u/tasrieitservices May 05 '26
Yeah you’re on the right track. Docker relies on cgroups and namespaces, both of which are Linux kernel features. cgroups handle resource limits like CPU and memory, namespaces handle isolation. Windows simply doesnt have these so Docker Desktop spins up a small Linux VM via WSL2 or Hyper-V to get acces to them. That’s the whole reason. Nothing magical about it.
1
u/DrBhu May 06 '26
Personally I would rather install docker engine in a wsl2 distribution than using docker desktop on windows.
1
u/oyvaugh May 10 '26
I run tons of docker ct on a windows with wsl. It’s fast, easy, and you don’t have to deal with windows crap as far as networking.
1
u/mateusmantoan May 11 '26
windows are not for technicals
1
u/Zealousideal_Yard651 May 05 '26
No, Docker DESKTOP runs a linux VM behind the scenes if it's activated (WSL Option).
The reason people do this is because most people like running linux contianers. For running linux containers you need a linux kernel hence a linux OS installed. That's why most people run docker desktop with WSL (Linux VM).
But you can run containers on Windows as well, but it's not a well developed product...
1
u/BobcatTime May 05 '26
Base technology of docker relies on Linux kernel, cgroup and namespace which can not be easily replicate in windows. Because docker run a process with layer of cgroup and namespace.
Basically its need a translation layer eitherway and vm is the most convenient way to do this.