Understanding Nano Server in Windows Server 2022

Nano Server in Windows Server 2022 is fundamentally different from the standalone deployment model introduced in Windows Server 2016. Microsoft deprecated the standalone Nano Server installation option after Windows Server 1709, and in Windows Server 2022 Nano Server exists exclusively as a container base image. It is no longer an option you can install on bare metal or as a virtual machine guest OS. Instead, it serves as an ultra-minimal Windows container image published on Microsoft Container Registry (MCR), designed for running .NET applications in containers with the smallest possible footprint.

This distinction is critical for architects and administrators coming from Server 2016 environments. If you are planning a deployment of Nano Server as a lightweight server OS, that path no longer exists. The correct modern approach is to pull the mcr.microsoft.com/windows/nanoserver image and build your application container on top of it. This article covers everything you need to know about using Nano Server as a container base image on Windows Server 2022 hosts.

Prerequisites for Running Nano Server Containers

To run Nano Server containers on Windows Server 2022, you need the Containers feature enabled on the host, along with a compatible container runtime such as Docker or containerd. The Windows Server 2022 host kernel must match the Nano Server image tag version for process-isolated containers. Hyper-V isolation relaxes this requirement by running the container in a lightweight Hyper-V utility VM.

Install the Containers feature and Docker on the host with the following commands run in an elevated PowerShell session:

Install-WindowsFeature -Name Containers -Restart

After the restart, install Docker Engine:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -OutFile install-docker-ce.ps1
.install-docker-ce.ps1

Verify Docker is running:

Get-Service docker
docker version

Pulling the Nano Server 2022 Image from MCR

The Nano Server image for Windows Server 2022 is published under the ltsc2022 tag. Microsoft maintains the image at mcr.microsoft.com/windows/nanoserver. Pull it with:

docker pull mcr.microsoft.com/windows/nanoserver:ltsc2022

You can also use the 2022 tag alias. Once pulled, inspect the image size. The Nano Server ltsc2022 image is typically around 100-110 MB compressed, compared to the Windows Server Core image which is closer to 2.5 GB compressed. This compact size is the primary reason to choose Nano Server for .NET applications when you do not need the full Win32 API surface.

docker images mcr.microsoft.com/windows/nanoserver
docker inspect mcr.microsoft.com/windows/nanoserver:ltsc2022

What Is Included in Nano Server 2022

Nano Server 2022 contains a minimal subset of Windows. It includes the .NET runtime support libraries, WinSock networking stack, WMI provider host, a PowerShell-less command environment (cmd.exe is not present by default), and a small set of Windows system DLLs. Critically, Nano Server does NOT include:

– The full Win32 API surface (many legacy APIs are absent)
– MSI installer support
– Windows Management Instrumentation (WMI) console tools
– IIS (use Windows Server Core for IIS workloads)
– .NET Framework (only .NET 5+ / .NET Core is appropriate)
– PowerShell (must be added explicitly in your Dockerfile)
– Most Visual C++ redistributables

If your application depends on any of these, you must use the Windows Server Core base image (mcr.microsoft.com/windows/servercore:ltsc2022) instead.

Building .NET Applications on Nano Server

Nano Server is the optimal base for self-contained .NET 6, .NET 7, and .NET 8 applications that do not require the full Win32 API. The multi-stage build pattern is the standard approach: build in an SDK image, publish a self-contained executable, then copy only the output into a Nano Server runtime image.

Example Dockerfile for a .NET 8 console application:

# Stage 1: Build
FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-ltsc2022 AS build
WORKDIR /src
COPY . .
RUN dotnet publish -c Release -r win-x64 --self-contained true -o /app/publish

# Stage 2: Runtime
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["MyApp.exe"]

The key flag is --self-contained true combined with -r win-x64. This bundles the .NET runtime into the published output so the Nano Server image does not need a separate .NET runtime layer. The resulting container image will include only the Nano Server OS layer plus your application binary and its bundled runtime.

For ASP.NET Core applications, Microsoft provides pre-built Nano Server-based ASP.NET runtime images:

FROM mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-ltsc2022

These images add the ASP.NET Core runtime on top of Nano Server and are significantly smaller than their Server Core equivalents.

Running Nano Server Containers on Windows Server 2022

Run a Nano Server container interactively to explore it. Since PowerShell is not present by default, use cmd.exe:

docker run --rm -it mcr.microsoft.com/windows/nanoserver:ltsc2022 cmd.exe

Inside the container, run basic diagnostic commands:

ver
dir C:
whoami
ipconfig

You will see the container runs as ContainerUser by default. The filesystem is minimal. Note that net.exe and many other standard Windows tools are absent.

To add PowerShell to a Nano Server container, layer the PowerShell package on top:

FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
ARG PS_VERSION=7.4.2
RUN curl -L https://github.com/PowerShell/PowerShell/releases/download/v%PS_VERSION%/PowerShell-%PS_VERSION%-win-x64.zip -o ps.zip
RUN tar -xf ps.zip -C C:PowerShell
RUN setx PATH "%PATH%;C:PowerShell"
ENTRYPOINT ["pwsh.exe"]

Alternatively, use the official PowerShell image based on Nano Server:

docker pull mcr.microsoft.com/powershell:lts-nanoserver-ltsc2022
docker run --rm -it mcr.microsoft.com/powershell:lts-nanoserver-ltsc2022 pwsh.exe

Differences from Windows Server 2016 Nano Server

The 2016 Nano Server could be deployed as a standalone host OS — you could install it on a physical server, configure networking, join a domain, and deploy roles via packages using DISM. The 2022 version removes all of this. Key differences:

Deployment model: 2016 supported standalone bare-metal/VM deployment; 2022 is container-only.
Package system: 2016 had Server App-V packages (NanoServerPackage PowerShell module); 2022 has no such system — you add capabilities via Dockerfile layers.
Domain join: 2016 Nano Server could join Active Directory; 2022 container image cannot join a domain in the traditional sense (use gMSA for container AD authentication).
Remote management: 2016 allowed WinRM/CIM remote management; 2022 is managed via Docker/container orchestration.
Image size: Both are minimal, but 2022 benefits from years of image optimization and is well-integrated with modern .NET tooling.

Nano Server in Kubernetes (AKS and On-Premises)

Nano Server containers run in Kubernetes environments that support Windows nodes. On Azure Kubernetes Service (AKS), Windows node pools based on Windows Server 2022 can run Nano Server containers. On-premises Kubernetes clusters using kubeadm with Windows worker nodes can also run them.

A sample Kubernetes deployment manifest for a Nano Server-based .NET app:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nanoserver-app
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nanoserver-app
  template:
    metadata:
      labels:
        app: nanoserver-app
    spec:
      nodeSelector:
        kubernetes.io/os: windows
      containers:
      - name: app
        image: myregistry.azurecr.io/myapp:ltsc2022
        ports:
        - containerPort: 8080

The nodeSelector for kubernetes.io/os: windows is mandatory — Nano Server containers cannot run on Linux nodes.

Process Isolation vs. Hyper-V Isolation

Windows containers support two isolation modes. Process isolation shares the host kernel directly with the container. For this to work, the container image’s Windows version must match the host OS version. Hyper-V isolation runs each container inside a thin Hyper-V VM, allowing different Windows versions to run on the same host.

On Windows Server 2022, process-isolated Nano Server containers must use the ltsc2022 tag. To run an older Nano Server image (e.g., 1809) on a 2022 host, use Hyper-V isolation:

docker run --rm --isolation=hyperv mcr.microsoft.com/windows/nanoserver:1809 cmd.exe

For production workloads on Windows Server 2022, process isolation with the ltsc2022 tag is recommended for best performance and density.

Limitations and When to Use Windows Server Core Instead

Nano Server 2022 is not appropriate for all workloads. Use Windows Server Core (mcr.microsoft.com/windows/servercore:ltsc2022) when your application requires: IIS, MSMQ, .NET Framework (not just .NET 5+), COM components, MSI installers, full PowerShell including all modules, or any API in the kernel32.dll set not present in Nano Server.

The practical test is to run your application in a Nano Server container. If it fails with DllNotFoundException or EntryPointNotFoundException, you are likely hitting a missing Win32 API. In that case, move to Server Core. Nano Server is best reserved for greenfield .NET 6+ applications, microservices, and scenarios where image size is a primary concern.

For multi-container applications managed with Docker Compose, you can mix Nano Server and Server Core containers in the same docker-compose.yml, using Nano Server for lightweight .NET services and Server Core for components requiring broader Windows API coverage.