How to Set Up Nano Server on Windows Server 2025
Nano Server has undergone a significant transformation since its debut in Windows Server 2016. In Windows Server 2025, Nano Server is no longer available as a deployable virtual machine operating system or a physical host installation option. Instead, Microsoft has repositioned Nano Server exclusively as a container base image. This change reflects the industry shift toward containerised workloads, where Nano Server’s minimal footprint — no GUI, no interactive logon, no .NET Framework, no WMI — makes it an excellent base for lightweight application containers. If you are running .NET applications, microservices, or need the smallest possible Windows container image, Nano Server at mcr.microsoft.com/windows/nanoserver remains a compelling choice. This tutorial walks through pulling and running a Nano Server container, building a custom image with a Dockerfile, monitoring running containers, and comparing Nano Server with Server Core and Desktop Experience.
Prerequisites
- Windows Server 2025 with the Containers feature enabled
- Docker Engine for Windows (or Containerd with crictl) installed and running
- Internet access to pull images from Microsoft Container Registry (MCR)
- PowerShell 7.4+ or Windows PowerShell 5.1 with administrative privileges
- Sufficient disk space (Nano Server ltsc2025 image is approximately 100–130 MB compressed)
Step 1: Enable the Containers Feature and Install Docker
Before pulling any container image, the Windows Containers feature must be enabled and a container runtime installed. Run the following commands in an elevated PowerShell session:
# Enable the Containers Windows feature
Install-WindowsFeature -Name Containers -Restart
# After reboot, install Docker Engine using the official Microsoft script
Invoke-WebRequest -UseBasicParsing `
-Uri "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
Ensure the Docker service status shows Running before proceeding. If it does not start automatically, use Start-Service docker.
Step 2: Understanding the Nano Server Container Image
The Nano Server container image is hosted at Microsoft Container Registry. Microsoft publishes tags aligned to Windows Server LTSC releases. For Windows Server 2025 hosts, use the ltsc2025 tag to ensure host/container version compatibility:
# Pull the Nano Server ltsc2025 image
docker pull mcr.microsoft.com/windows/nanoserver:ltsc2025
# View the pulled image details
docker images mcr.microsoft.com/windows/nanoserver
# Inspect image layers and metadata
docker inspect mcr.microsoft.com/windows/nanoserver:ltsc2025
Notice the compressed size compared to Server Core. Nano Server intentionally omits:
- No interactive login (no console session)
- No .NET Framework (only .NET runtime can be added separately)
- No WMI, no MMC, no PowerShell (by default)
- No MSI support
- Minimal Win32 API surface
Step 3: Running a Basic Nano Server Container
Because Nano Server has no PowerShell by default, running an interactive shell requires the cmd.exe process. Use the following to start a container and verify the environment:
# Run an interactive Nano Server container using cmd.exe
docker run -it --rm mcr.microsoft.com/windows/nanoserver:ltsc2025 cmd.exe
# Inside the container — check OS version
ver
# Check available disk space and running processes
dir C:
tasklist
To run a container in detached mode for a longer-lived workload:
# Run a detached container that keeps running (ping loop as placeholder)
docker run -d --name nanotest mcr.microsoft.com/windows/nanoserver:ltsc2025 `
cmd.exe /c "ping -t 127.0.0.1 > nul"
# Check container status
docker ps
# Attach to view output
docker attach nanotest
# Stop and remove
docker stop nanotest
docker rm nanotest
Step 4: Running a .NET Application in a Nano Server Container
The primary production use case for Nano Server is hosting .NET 8 or .NET 9 applications. Microsoft publishes .NET runtime images based on Nano Server. Start by using the pre-built .NET runtime image:
# Pull .NET 8 runtime on Nano Server
docker pull mcr.microsoft.com/dotnet/runtime:8.0-nanoserver-ltsc2025
# Verify the image
docker images mcr.microsoft.com/dotnet/runtime
# Run a quick .NET version check inside the container
docker run --rm mcr.microsoft.com/dotnet/runtime:8.0-nanoserver-ltsc2025 `
dotnet --version
For ASP.NET Core web applications, use the ASP.NET Core Nano Server image:
# Pull ASP.NET Core runtime on Nano Server
docker pull mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-ltsc2025
# Run the container exposing port 8080
docker run -d -p 8080:8080 --name mywebapp `
mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-ltsc2025
Step 5: Building a Custom Nano Server Container Image
Create a Dockerfile that builds your application into a Nano Server image. The multi-stage pattern is recommended to keep the final image lean:
# Dockerfile — multi-stage build for a .NET 8 console application
# --- Build stage ---
FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-ltsc2025 AS build
WORKDIR /src
COPY ["MyApp/MyApp.csproj", "MyApp/"]
RUN dotnet restore "MyApp/MyApp.csproj"
COPY . .
WORKDIR /src/MyApp
RUN dotnet publish -c Release -o /app/publish --no-restore
# --- Runtime stage ---
FROM mcr.microsoft.com/dotnet/runtime:8.0-nanoserver-ltsc2025 AS runtime
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "MyApp.dll"]
Build and run the custom image:
# Build the image from the directory containing your Dockerfile
docker build -t myapp:1.0 .
# Run the custom image
docker run --rm --name myapp-container myapp:1.0
# Tag and push to a private registry (example: Azure Container Registry)
docker tag myapp:1.0 myregistry.azurecr.io/myapp:1.0
docker push myregistry.azurecr.io/myapp:1.0
Step 6: Monitoring a Nano Server Container
Use Docker’s built-in stats and logging commands to monitor Nano Server containers in real time:
# View real-time CPU, memory, and network stats for all running containers
docker stats
# View stats for a specific container by name
docker stats nanotest
# View container logs (stdout/stderr from the process)
docker logs nanotest
docker logs --follow --tail 50 nanotest
# Inspect detailed container metadata including IP, mounts, and config
docker inspect nanotest
# View running processes inside a container (Windows containers)
docker top nanotest
For production environments, forward container logs to a centralised log sink such as Azure Monitor or Windows Event Log using Docker’s logging drivers:
# Run a container with json-file logging driver and size limits
docker run -d --name nanoapp `
--log-driver json-file `
--log-opt max-size=10m `
--log-opt max-file=3 `
mcr.microsoft.com/windows/nanoserver:ltsc2025 cmd.exe /c "ping -t 127.0.0.1 > nul"
Step 7: Comparing Nano Server, Server Core, and Desktop Experience
Understanding when to use each installation option is important for architectural decisions on Windows Server 2025:
- Desktop Experience: Full GUI with all management tools. Use for workloads that require graphical administration, legacy applications, or features unavailable in headless configurations. Largest disk and memory footprint.
- Server Core: Headless installation deployable as VM or physical host. Supports PowerShell, .NET Framework, most Windows Server roles (AD DS, DNS, DHCP, IIS, Hyper-V). Reduced attack surface. Also available as a container base image at
mcr.microsoft.com/windows/servercore. - Nano Server (container only): Smallest possible Windows container image. No interactive logon, no WMI, no .NET Framework. Ideal for .NET Core microservices, stateless applications, and CI/CD pipelines where image size and startup speed are critical.
# Compare image sizes side by side
docker images | Select-String "nanoserver|servercore|windows/server"
# Typical approximate compressed sizes (ltsc2025):
# Nano Server: ~120 MB
# Server Core: ~3.5 GB
# Windows Server: ~5+ GB
Conclusion
Nano Server in Windows Server 2025 is a purpose-built container base image optimised for running .NET Core workloads with the smallest possible footprint, fastest startup times, and minimal attack surface. While it can no longer serve as a VM operating system, its role in containerised architectures is well-defined and highly effective. By pulling the image from MCR, building multi-stage Dockerfiles, and leveraging the .NET SDK and runtime images layered on top of Nano Server, you can produce lean, production-ready containers that integrate naturally with Azure Container Registry, Azure Kubernetes Service, and on-premises container hosts running Windows Server 2025. For workloads requiring more Windows API surface or legacy components, Server Core remains the appropriate headless option, while Desktop Experience covers scenarios demanding full GUI access.