![]() |
VOOZH | about |
Chiselled Ubuntu runtime image for .NET apps. Long-term tracks maintained by Canonical.
100K+
ubuntu/dotnet-runtime is a rock for dotnet-runtime maintained by Canonical.
.NET is a free, cross-platform, open source developer platform for building many different types of applications. With .NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, games, IoT, and more. Read the .NET documentation to learn how to deploy your .NET application with container images.
This image does not include bash nor a package manager nor the .NET SDK. Read more about Chiselled Ubuntu for .NET, a new class of OCI images, on the Ubuntu blog; reading how Canonical and Microsoft partner together to deliver and support .NET on Ubuntu.
If you're looking to publish a self-contained .NET app, please have a look at the ubuntu/dotnet-deps repository.
If you're looking to publish an ASP.NET app, please then look at the ubuntu/dotnet-aspnet repository.
[Learn more about dotnet-runtime]
NOTE: These tags follow a specific naming convention that respects the concept of channels.
| Tags | Supported until | Version | Base | Architectures | |
|---|---|---|---|---|---|
8.0-24.04_stable | 11/2026 | 8.0 | 24.04 | amd64, arm64, ppc64le, s390x | |
10.0-26.04_edge | 05/2031 | 10.0 | 26.04 | amd64, arm64 |
This rock's entrypoint is Pebble, a container-optimized init process that enables the orchestration of a collection of local service processes as an organized set.
To view the Pebble services and checks defined in this rock:
docker run --rm ubuntu/dotnet-runtime:9.0-25.04_stable plan
To run this rock, use any of the usual container runtimes, for example, docker:
docker run --name dotnet-runtime-container \
-e TZ=UTC \
ubuntu/dotnet-runtime:9.0-25.04_stable \
exec dotnet
The container logs simply show the .NET help message. This is because the container expects a .NET application to be given.
In some cases, you may want to augment this rock with additional runtime dependencies. In that case, you can use this rock as a base for your own custom build, as exemplified below:
Here is an example using a Dockerfile to build a .NET application image on top of a dotnet-runtime image:
# Create a HelloWorld.csproj file with the following content
$ cat <<EOF > HelloWorld.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
EOF
# Create a Program.cs file with the following code
$ cat <<EOF > Program.cs
Console.WriteLine("Hello, World!");
EOF
Create a Dockerfile with the following content:
FROM ubuntu:26.04 AS builder
RUN apt-get update && apt-get install -y dotnet10 ca-certificates
# add your application code
WORKDIR /source
COPY . .
# publish your .NET app
RUN dotnet publish -c Release -o /app
FROM ubuntu/dotnet-runtime:10.0-26.04_edge
WORKDIR /app
COPY --from=builder /app ./
CMD ["exec", "dotnet", "/app/HelloWorld.dll"]
Build and run the image with the following commands:
$ docker build -t hello-world-app .
$ docker run --rm hello-world-app # This prints "Hello, World!"
# Using .NET8 as an example
# Create a HelloWorld.csproj file with the following content
$ cat <<EOF > HelloWorld.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
EOF
# Create a Program.cs file with the following code
$ cat <<EOF > Program.cs
Console.WriteLine("Hello, World!");
EOF
Create a Dockerfile with the following content:
FROM ubuntu:24.04 AS builder
# install the .NET 8 SDK from the Ubuntu archive
# (no need to clean the apt cache as this is an unpublished stage)
RUN apt-get update && apt-get install -y dotnet8 ca-certificates
# add your application code
WORKDIR /source
COPY . .
# publish your .NET app
RUN dotnet publish -c Release -o /app
FROM ubuntu/dotnet-runtime:8.0-24.04_beta
WORKDIR /app
COPY --from=builder /app ./
ENTRYPOINT ["dotnet", "/app/HelloWorld.dll"]
Build and run the image with the following commands:
$ docker build -t hello-world-app .
$ docker run --rm hello-world-app # This prints "Hello, World!"
To view the logs of the running container, run:
docker exec dotnet-runtime-container pebble logs
Or, for a specific service:
docker exec dotnet-runtime-container pebble logs <service>
Rocks may have predefined health checks that you can list by running:
docker exec dotnet-runtime-container pebble checks
The overall health of your container can be inspected via:
docker exec dotnet-runtime-container pebble health
| Option | Description | Default |
|---|---|---|
| TZ | Set the timezone for the container | UTC |
| DOTNET_SYSTEM_GLOBALIZATION_INVARIANT | Whether to use invariant globalization mode. | true |
| ASPNETCORE_URLS | The URLs that the ASP.NET Core app should listen on. | http://+:8080 |
Canonical is the provider of this container image. It is the user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within, as well as with Canonical’s IP Policy.
Content type
Image
Digest
sha256:65715dc44…
Size
45.4 MB
Last updated
1 day ago
Requires Docker Desktop 4.37.1 or later.
Pulls:
2,414
Last week