dotnet-aspnet
Used to run ASP.NET Core applications on the .NET runtime in production environments.
What is dotnet-aspnet?
The dotnet-aspnet image is part of Microsoft’s official .NET container image set. It provides the .NET runtime and libraries needed to run ASP.NET Core applications, making it the recommended base image for deploying production web APIs, microservices, and web apps built with .NET.
Unlike the dotnet-sdk
image, which includes compilers and build tools, the dotnet-aspnet
image is optimized for running prebuilt applications. This separation allows teams to build applications in larger sdk
images and run them in smaller, secure aspnet
images.
Because it is published and maintained by Microsoft, the dotnet-aspnet image receives timely security patches and aligns with official .NET release cycles, including LTS (Long-Term Support) versions.
How to use this image
The dotnet-aspnet image is typically used as the base image in a multi-stage Dockerfile.
Examples:
You can also run it directly to confirm the runtime:
<code>docker run --rm mcr.microsoft.com/dotnet/aspnet:8.0 dotnet --info</code>
Image variants
The dotnet-aspnet image is published under mcr.microsoft.com/dotnet/aspnet
with several variants:
dotnet/aspnet:<major.minor>
Version-pinned images (e.g., dotnet/aspnet:8.0
) tied to specific .NET releases. Recommended for production to ensure predictable behavior.
dotnet/aspnet:<major.minor>-alpine
Lightweight variant built on Alpine Linux, offering smaller image sizes but with musl libc instead of glibc.
dotnet/aspnet:latest
Tracks the most recent stable release. Useful for local testing or development but not recommended for production.