How to Set Up Windows Server 2019 Nano Server
Windows Server 2019 Nano Server is an ultra-minimal deployment option designed specifically for running as a container host or cloud-optimised workload. Unlike Server Core which retains most Windows Server capabilities in a headless form, Nano Server in Windows Server 2019 has been redesigned exclusively as a container base image. It cannot be installed directly on physical or virtual hardware as a standalone OS in the traditional sense — instead it is used as a container base image for Windows container workloads. This article covers how to use and work with Nano Server container images in Windows Server 2019.
Nano Server in Windows Server 2019 vs Earlier Versions
In Windows Server 2016, Nano Server could be deployed as a standalone headless server (no GUI, no .NET Framework, very limited footprint). Beginning with Windows Server 1709 and continuing through Windows Server 2019, Nano Server is available only as a container base image. This means you cannot boot a physical server or VM directly into Nano Server — you use it as the FROM image in a Dockerfile to create lightweight Windows containers. The mcr.microsoft.com/windows/nanoserver:ltsc2019 image is approximately 100 MB, compared to the Server Core base image at around 1.5 GB.
Setting Up the Container Host
To use Nano Server containers, first configure a Windows Server 2019 host with the Containers feature and Docker. The host itself is typically a Server Core or Desktop Experience installation.
# Install the Containers feature on the Windows Server 2019 host
Install-WindowsFeature -Name Containers -Restart
# After restart, install Docker Engine
Install-Module -Name DockerProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerProvider -Force -RequiredVersion 20.10.9
# Start Docker service
Start-Service Docker
Set-Service Docker -StartupType Automatic
# Verify Docker is running
docker version
docker info
Pulling the Nano Server Base Image
Pull the official Windows Server 2019 Nano Server base image from the Microsoft Container Registry.
# Pull the Nano Server LTSC 2019 image
docker pull mcr.microsoft.com/windows/nanoserver:ltsc2019
# List downloaded images
docker images
# Check the image size (typically ~100 MB)
docker images mcr.microsoft.com/windows/nanoserver:ltsc2019 --format "table {{.Repository}}t{{.Tag}}t{{.Size}}"
Running a Nano Server Container
Run a Nano Server container interactively or detached. Because Nano Server has no PowerShell by default (only cmd.exe in the ltsc2019 base image), use cmd.exe for interactive sessions or install PowerShell as part of your Dockerfile.
# Run a Nano Server container interactively with cmd.exe
docker run -it mcr.microsoft.com/windows/nanoserver:ltsc2019 cmd.exe
# Run a one-off command and exit
docker run --rm mcr.microsoft.com/windows/nanoserver:ltsc2019 cmd /c systeminfo | findstr /C:"OS Name"
# Run detached with a name
docker run -d --name nanotest mcr.microsoft.com/windows/nanoserver:ltsc2019 cmd /c "ping -t localhost"
# Execute a command in the running container
docker exec nanotest cmd /c dir C:
Building a Custom Nano Server Container Image
The primary use of Nano Server is as a FROM base in Dockerfiles for custom application images. Create a Dockerfile that adds your application files and sets the entry point.
# Example Dockerfile for a .NET console application on Nano Server
# Save as Dockerfile in your application directory
FROM mcr.microsoft.com/windows/nanoserver:ltsc2019
# Copy application binaries
COPY publish/ /app/
# Set working directory
WORKDIR /app
# Set the entry point
ENTRYPOINT ["dotnet", "MyApp.dll"]
# Build the custom image
docker build -t myapp:1.0 .
# Run the custom application container
docker run --rm myapp:1.0
Adding PowerShell to a Nano Server Image
The Nano Server base image does not include PowerShell. Use the PowerShell layer on top of Nano Server for containers that need PowerShell scripting.
# Use the PowerShell Nano Server image (Microsoft maintains this)
docker pull mcr.microsoft.com/powershell:nanoserver-ltsc2019
# Run PowerShell in a Nano Server container
docker run -it mcr.microsoft.com/powershell:nanoserver-ltsc2019 pwsh.exe
# Or build your own image with PowerShell installed
# Dockerfile:
# FROM mcr.microsoft.com/windows/nanoserver:ltsc2019
# SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';"]
# Use the PowerShell layer as FROM for simplicity
Nano Server Networking
Configure container networking for Nano Server containers. Docker on Windows supports NAT (default, isolated with port mapping), transparent (bridge to physical network), overlay (for Swarm clustering), and l2bridge/l2tunnel networking modes.
# List available Docker networks
docker network ls
# Run a Nano Server container with port mapping (NAT networking)
docker run -d -p 8080:80 --name webserver mywebapp:1.0
# Run with a specific network
docker run -d --network transparent --name appserver myapp:1.0
# Inspect container network settings
docker inspect nanotest --format "{{.NetworkSettings.Networks}}"
Using Nano Server for IIS Web Applications
IIS is not available on Nano Server — use the Windows Server Core base image for IIS-based workloads. For Nano Server, lightweight web servers like Kestrel (.NET Core), Go HTTP servers, or custom socket listeners are appropriate.
# ASP.NET Core on Nano Server Dockerfile example
FROM mcr.microsoft.com/dotnet/runtime:8.0-nanoserver-ltsc2019 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-ltsc2019 AS build
WORKDIR /src
COPY ["MyWebApp.csproj", "./"]
RUN dotnet restore
COPY . .
RUN dotnet build -c Release -o /app/build
FROM build AS publish
RUN dotnet publish -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
EXPOSE 8080
ENTRYPOINT ["dotnet", "MyWebApp.dll", "--urls", "http://0.0.0.0:8080"]
Managing Nano Server Containers
# List running containers
docker ps
# List all containers including stopped
docker ps -a
# View container logs
docker logs nanotest
# Stop and remove a container
docker stop nanotest
docker rm nanotest
# Remove all stopped containers
docker container prune -f
# View resource usage
docker stats --no-stream
Container Image Registry
Push custom Nano Server-based images to a private registry for deployment across multiple container hosts.
# Tag the image for a private registry
docker tag myapp:1.0 registry.corp.local:5000/myapp:1.0
# Log in to the private registry
docker login registry.corp.local:5000
# Push the image
docker push registry.corp.local:5000/myapp:1.0
# Pull on another host
docker pull registry.corp.local:5000/myapp:1.0
Conclusion
Windows Server 2019 Nano Server serves as an ultra-compact container base image optimised for cloud-native .NET applications. With a footprint of approximately 100 MB, it significantly reduces the attack surface and startup time for containerised workloads. Building custom application images from the Nano Server base, leveraging .NET Core runtimes on top of Nano Server, and deploying through private registries provides a complete containerisation workflow. Nano Server is the right choice when minimal image size and maximum security hardening are priorities for Windows-based containerised applications.