Skip to main content
To understand how Docker works, we first revisit a few core operating system concepts that Docker builds on. Most Linux distributions — for example Ubuntu, Fedora, openSUSE, or AlmaLinux — are composed of two main layers: the kernel and the userland (user-space) software. The kernel interacts with the hardware and provides core OS services (process scheduling, memory management, device drivers, networking). The userland includes shells, libraries, package managers, GUIs, and developer tools. In the Linux ecosystem the kernel family (Linux) is shared across distributions; what differentiates distributions is the userland software stack. Because distributions share the same kernel, Docker containers take advantage of that by packaging only the userland components an application needs. Containers reuse the host kernel while providing each container an isolated user-space environment. A quick comparison: Sharing the kernel.
A presenter in a KodeKloud t-shirt stands in front of a slide titled "Sharing The Kernel" that shows icons for Ubuntu, Fedora, openSUSE, and AlmaLinux. The slide illustrates each distro's software layer above a shared OS Kernel — Linux.
Because the host provides the kernel, a Linux host running Docker can start containers whose images contain userlands from Debian, Fedora, openSUSE, AlmaLinux, or other distributions. Each container includes the user-space libraries, binaries, and configuration that define its environment; the container processes run on the host kernel but inside isolated userland namespaces. This isolation is provided by kernel primitives:
  • Namespaces — isolate process IDs, mount points, network stacks, UTS (hostname), IPC, and user IDs so container processes see their own environment.
  • Control groups (cgroups) — enforce resource limits and accounting for CPU, memory, block I/O, and more.
  • Union file systems (overlayfs, AUFS, etc.) — enable layered, copy-on-write images to keep containers lightweight.
What happens when the host and container kernels differ — for example, Windows vs Linux? A Linux host cannot natively run a Windows container because Windows uses a different kernel.
A Linux kernel cannot execute Windows kernel binaries. To run Windows containers you need Docker on a Windows host that provides the Windows kernel.
You may, however, have seen Docker start a Linux container on a Windows machine. In that case Docker Desktop provisions a small Linux environment so the container can access a Linux kernel. Historically this used Hyper-V; modern Docker Desktop often uses the Windows Subsystem for Linux 2 (WSL2) backend. The practical effect is: the Linux container runs inside a Linux VM that itself runs on Windows.
Docker Desktop uses a lightweight Linux VM (or WSL2 on modern Windows) so Linux containers can run on non-Linux hosts. On macOS Docker Desktop similarly runs a small Linux VM. This is why Docker commands behave the same cross-platform even when the host OS differs.
A slide titled "Sharing The Kernel" showing nested boxes: a Windows Host containing a Linux VM which contains a Linux Container. A presenter wearing a KodeKloud T-shirt stands to the right of the slide.
Does kernel-sharing limit Docker? Not for its intended use cases. Docker is not a hypervisor replacement for running unrelated kernels concurrently; hypervisors virtualize hardware so you can run different kernels and full OSes side-by-side. Docker’s strength is packaging applications and their dependencies into lightweight, portable containers that:
  • Start faster than VMs
  • Use less disk and memory
  • Are easier to distribute and deploy
For workloads that require complete OS isolation or different kernels, use a virtualization solution (hypervisor). For application packaging, consistent runtime environments, and efficient resource usage, containers are usually the better option. Comparison: containers vs hypervisors Further reading and references:

Watch Video