dotnet-sdk

An image used to build, test, and publish .NET applications with the full .NET SDK.

dotnet-aspnet
dotnet-runtime
mcr-dotnet
mono

What is dotnet-sdk?

The dotnet-sdk image is part of Microsoft’s official .NET container images. It provides the complete .NET SDK, including compilers, build tools, and the runtime, making it suitable for building and testing .NET applications inside containers.

This image is typically used during development and CI/CD pipelines to restore dependencies, compile source code, run tests, and publish production-ready artifacts. The resulting applications are often copied into a smaller runtime image such as dotnet-aspnet or dotnet-runtime for deployment.

Because it includes all necessary tooling, the dotnet-sdk image is larger than runtime-only images. It is updated regularly by Microsoft and aligned with official .NET release cycles, including long-term support (LTS) releases.

How to use this image

The dotnet-sdk image is most often used as the build stage in multi-stage Dockerfiles.

Examples:

# Build stage FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src COPY . . RUN dotnet restore RUN dotnet publish -c Release -o /app # Runtime stage FROM mcr.microsoft.com/dotnet/aspnet:8.0 WORKDIR /app COPY --from=build /app . ENTRYPOINT ["dotnet", "MyApp.dll"]

You can also run it interactively to use the CLI inside a container:

<code>docker run --rm -it mcr.microsoft.com/dotnet/sdk:8.0 bash</code>

Image variants

The dotnet-sdk image is published under mcr.microsoft.com/dotnet/sdk and available in several forms:

dotnet/sdk:<major.minor>

Version-pinned images (e.g., dotnet/sdk:8.0) tied to specific .NET releases. Recommended for reproducible builds.

dotnet/sdk:<major.minor>-alpine

Lightweight variant built on Alpine Linux. Smaller footprint but uses musl libc, which can affect compatibility in some scenarios.

dotnet/sdk:latest

Tracks the most recent stable SDK release. Useful for development but not ideal for production pipelines.

Interested in base images that start and stay clean?

This is a not a valid email
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.