Windows Containers with Docker: Architecture, Isolation, and Setup
Windows containers package a Windows application and its dependencies into an image that can be built and run consistently on compatible Windows hosts. They are useful when software depends on Windows APIs, IIS, or the full .NET Framework, but they are not interchangeable with Linux containers: image and host compatibility still matters. This guide explains the architecture, isolation choices, runtime setup, and a small Docker workflow for developers and operators.
What Are Windows Containers?
A Windows container is an isolated application environment built from a Windows base image. The image supplies the user-mode files and libraries the application needs; the host supplies the Windows kernel. A container runtime creates and manages the container process, its filesystem view, network connections, and resource limits.
Docker is one way to build and manage these images, but Docker is not the Windows kernel or the isolation boundary itself. Docker Desktop is commonly used for local development, while Windows Server deployments use a supported container runtime installed on the server. Microsoft’s overview of Windows containers describes the platform and its host requirements.
Why Windows Containers Exist
Some workloads depend on Windows-specific behavior that a Linux image cannot provide: legacy .NET Framework applications, Windows services, IIS modules, COM components, or native Windows APIs. Rewriting these applications may be costly or impractical, while deploying a full virtual machine for every service can make builds, releases, and scaling heavier.
Windows containers provide a repeatable package for these workloads and let teams automate image builds and deployments. They do not remove operating-system dependencies, however. A Windows image needs a compatible Windows environment, and configuration, secrets, persistent data, and patching still need deliberate management.
How Windows Containers Work
A typical build and run path is:
Dockerfile and application files -> Windows image layers -> local image store or registry -> Docker Engine and container runtime -> Host Compute Service -> isolated container process
The Docker CLI sends requests to an engine or compatible runtime. On Windows, the Host Compute Service (HCS) creates and manages the container or its utility virtual machine. The Host Networking Service (HNS) configures container networks and endpoints. The container filesystem is assembled from image layers with a writable layer for that instance; data in the writable layer should be treated as temporary.
Windows images follow OCI image conventions, but that does not make them portable to Linux hosts. The image still depends on Windows user-mode components and a compatible Windows kernel. Process isolation shares the host kernel. Hyper-V isolation places the container in a lightweight utility VM with its own kernel. Microsoft’s Windows container version compatibility guidance explains which host and image combinations work; check its current matrix rather than assuming that any newer host can run any older image.
Components and Variants
Isolation modes
| Mode | Kernel boundary | Typical reason to choose it | Main consideration |
|---|---|---|---|
| Process isolation | Container processes share the host kernel | Lower overhead when the host and image versions are compatible | Compatibility is constrained by the Windows host/image matrix |
| Hyper-V isolation | A lightweight VM supplies a separate kernel | Stronger kernel separation or a supported host/image version mismatch | Requires Hyper-V capability and adds VM overhead |
Neither mode changes an application into a Linux workload. Hyper-V isolation can relax some version-matching requirements, but the supported combinations still depend on the image and host; verify them before deployment.
Base images
| Image family | Useful for | Check before choosing |
|---|---|---|
| Nano Server | Small, server-oriented applications that need only its limited API surface | Confirm that required Windows components and diagnostics are available |
| Server Core | Applications needing broader Windows compatibility, including many IIS and .NET Framework workloads | Larger download and storage footprint than Nano Server |
| Windows base image | Software that requires components not included in the smaller images | Largest footprint; use only when the application needs its broader surface |
Windows containers also differ from Linux containers in host-kernel and image compatibility, available image families, path conventions, and networking implementation. Choose a base image based on the APIs the application actually uses, then test it against the target host.
Real-World Use Cases
- Legacy web applications: Package IIS-hosted applications and .NET Framework dependencies without first porting them to Linux.
- Windows services and background jobs: Run a Windows-dependent worker with an explicit process lifecycle and deployment artifact.
- Build and test pipelines: Use a known Windows image to compile, test, or package software that requires Windows tooling.
- Incremental modernization: Containerize a Windows-dependent component while other services in the system use Linux containers.
If an application is already portable to Linux, compare the operational and image-size trade-offs before choosing a Windows base image. Windows containers are most valuable when their Windows compatibility is needed.
Practical Considerations
Choose a host and runtime
For desktop development, install Docker Desktop on a supported Windows edition and enable Windows container mode. Windows container workloads on Windows client systems use Hyper-V isolation; check Docker’s current Windows installation requirements and Microsoft’s environment setup guide before enabling features.
For Windows Server, select a runtime supported for that host. Microsoft’s setup guide currently documents Moby, Mirantis Container Runtime, and containerd options. Follow the current instructions for the chosen runtime; older tutorials that install DockerMsftProvider do not reflect the present setup path. Keep the Windows host, container runtime, and base image within their supported lifecycles.
Build and run a smoke-test image
Choose a Windows Server Core LTSC image tag that the target host supports, using the compatibility matrix. Pass its tag to the build instead of assuming the same tag works on every host.
Dockerfile:
ARG WINDOWS_BASE
FROM ${WINDOWS_BASE}
CMD ["cmd", "/S", "/C", "ver"]
In PowerShell, set WINDOWS_CONTAINER_TAG to a supported tag from the Microsoft Container Registry, then build and run:
$env:WINDOWS_CONTAINER_TAG = '<supported-ltsc-tag>'
$image = "mcr.microsoft.com/windows/servercore:$env:WINDOWS_CONTAINER_TAG"
docker build --build-arg "WINDOWS_BASE=$image" -t windows-smoke-test .
docker run --rm windows-smoke-test
docker info --format '{{.OSType}}'
The docker info command should report windows. A failure to pull or start the image can indicate that Docker is in Linux-container mode, that the host and image versions are incompatible, or that the required isolation feature is unavailable. Resolve compatibility against the target runtime rather than switching tags at random.
Plan networking, storage, and security
Windows container networking is managed through HNS. NAT networks and published ports are common for local development, but the host firewall and runtime configuration still control reachability. Validate name resolution and inbound access in the same environment where the workload will run.
A container’s writable layer is not durable storage. Use a volume or a host bind mount for state that must survive container replacement, and confirm the Windows path and permissions work with the selected runtime. Keep secrets outside the image, use maintained base images, apply resource limits where supported, and grant containers only the access they need. Hyper-V isolation adds a kernel boundary, but it does not replace image patching, access control, or workload hardening.
Common Misconceptions
- “A Windows image can run on any Docker host.” It needs a Windows-compatible environment and a supported host/image combination; Docker does not translate Windows system calls for a Linux kernel.
- “Every Windows container shares the host kernel.” Process-isolated containers do, but Hyper-V-isolated containers run with a separate kernel in a utility VM.
- “Hyper-V isolation makes compatibility irrelevant.” It can support additional combinations, but the Microsoft compatibility matrix remains the source of truth.
- “Docker Desktop is the Windows Server production runtime.” Docker Desktop is a desktop development product. Server deployments need a separately selected and supported runtime.
- “A container is a virtual machine.” A process-isolated container shares the host kernel; even with Hyper-V isolation, its image and management model differ from a general-purpose VM.

