dotnet-runtime
Used to run .NET applications with the .NET runtime, without build tools or SDK components.
What is dotnet-runtime?
The dotnet-runtime image is part of Microsoft’s official .NET container image set. It contains only the .NET runtime and base libraries required to run prebuilt .NET applications. Unlike dotnet-sdk
, it does not include compilers or build tools, and unlike dotnet-aspnet
, it does not include the ASP.NET Core libraries.
This image is best suited for console applications, background workers, or services that do not require the ASP.NET Core framework. Because it is smaller and more focused than the SDK or ASP.NET images, it reduces the attack surface and improves startup time in production.
The image is maintained by Microsoft and follows the official .NET release cycle, including LTS (Long-Term Support) releases.
How to use this image
The dotnet-runtime image is typically used as the runtime stage in a multi-stage Dockerfile.
Examples:
You can also run it directly to confirm the runtime version:
<code>docker run --rm mcr.microsoft.com/dotnet/runtime:8.0 dotnet --info</code>
Image variants
The dotnet-runtime image is published under mcr.microsoft.com/dotnet/runtime
and available in these forms:
dotnet/runtime:<major.minor>
Version-pinned images (e.g., dotnet/runtime:8.0
) tied to specific .NET releases. Recommended for production deployments.
dotnet/runtime:<major.minor>-alpine
A lightweight variant built on Alpine Linux. Offers smaller size but uses musl libc instead of glibc, which may affect compatibility with some libraries.
dotnet/runtime:latest
Tracks the most recent stable runtime release. Useful for testing but not ideal for production due to potential version drift.