用于ASP.NET应用的精简Ubuntu运行时镜像,由Canonical维护的长期支持版本。

28 次收藏下载次数: 0状态:社区镜像维护者:Ubuntu 官方镜像仓库类型:镜像最近更新:
下载命令
点击查看

ubuntu/dotnet-aspnet is a rock for dotnet-aspnet maintained by https://canonical.com/.

ASP.NET is an open source web framework, created by Microsoft, for building modern web apps and services with .NET. Read the .NET documentation to learn how to deploy your .NET application with container images.

About ***led Ubuntu

This image does not include bash nor a package manager nor the .NET SDK. Read more about ***led Ubuntu for .NET, a new class of OCI images, on https://ubuntu.com/blog/install-dotnet-on-ubuntu; 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 for the .NET runtime (without ASP.NET), please then look at the ubuntu/dotnet-runtime repository.

[Learn more about dotnet-aspnet]

Tags and Architectures

NOTE: These tags follow a specific naming convention that respects the concept of channels.

TagsSupported untilVersionBaseArchitectures
10.0-26.04_stable
aliases10.0-26.04, 10.0-26.04_beta, 10.0-26.04_candidate, 10.0-26.04_edge
05/203110.026.04amd64, ppc64le, arm64, s390x
8.0-24.04_stable
aliases8.0, 8.0-24.04_172, 8.0-24.04_beta, 8.0-24.04_beta_172, 8.0-24.04_candidate, 8.0-24.04_candidate_172, 8.0-24.04_edge, 8.0-24.04_edge_172, 8.0-24.04_stable_172, 8.0_beta, 8.0_candidate, 8.0_edge, 8.0_stable, beta, candidate, edge, stable
11/20268.024.04amd64, arm64, ppc64le, s390x
View deprecated tags
TagsSupport ended onUpgrade Path
9.0-25.04_stable
aliases9.0-25.04, 9.0-25.04_beta, 9.0-25.04_candidate
01/2026 -
9.0-24.10_stable
aliases9.0, 9.0-24.10_145, 9.0-24.10_beta, 9.0-24.10_beta_145, 9.0-24.10_candidate, 9.0-24.10_candidate_145, 9.0-24.10_edge, 9.0-24.10_edge_145, 9.0-24.10_stable_145, 9.0_beta, 9.0_candidate, 9.0_edge, 9.0_stable
07/2025 -
6.0-22.04_stable
aliases6.0, 6.0-22.04_172, 6.0-22.04_beta, 6.0-22.04_beta_172, 6.0-22.04_candidate, 6.0-22.04_candidate_172, 6.0-22.04_edge, 6.0-22.04_edge_172, 6.0-22.04_stable_172, 6.0_beta, 6.0_candidate, 6.0_edge, 6.0_stable
11/2024 -
7.0-23.04_beta
aliases7.0-23.04_73, 7.0-23.04_beta_73, 7.0-23.04_edge_73, 7.0_beta
05/2024 -
6.0-22.10_beta
aliases6.0-22.10_1, 6.0-22.10_edge_1
07/2023 -
9.0-25.04_edge
aliases9.0-25.04_edge
01/2026 -
7.0-23.04_edge
aliases7.0-23.04_100, 7.0-23.04_edge_100, 7.0_edge
05/2024 -
7.0-22.10_edge
aliases7.0-22.10_61, 7.0-22.10_edge_61
07/2023 -
6.0-22.10_edge
aliases6.0-22.10_61, 6.0-22.10_edge_61
07/2023 -

Get started

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.

\https://documentation.ubuntu.com/pebble/\]

Inspect

To view the https://documentation.ubuntu.com/rockcraft/en/latest/reference/rockcraft-yaml/#services and https://documentation.ubuntu.com/rockcraft/latest/reference/rockcraft-yaml/#checks defined in this rock:

sh
docker run --rm ubuntu/dotnet-aspnet:9.0-25.04_stable plan
For an older version that is not a rock

The container spins up with the default entrypoint. To inspect the entrypoint and command:

sh
docker inspect --format='{{.Config.Entrypoint}} {{.Config.Cmd}}' ubuntu/dotnet-aspnet:9.0-25.04_stable

Run

To run this rock, use any of the usual container runtimes, for example, docker:

sh
docker run --name dotnet-aspnet-container \
    -e TZ=UTC \
    ubuntu/dotnet-aspnet:9.0-25.04_stable \
    exec dotnet

The container logs will show the .NET runtime information and help message. This is because the container expects an application to be given.

For an older version that is not a rock
sh
docker run --name dotnet-aspnet-container \
    -e TZ=UTC \
    ubuntu/dotnet-aspnet:9.0-25.04_stable

The container logs shows the .NET runtime information, as the container has /usr/bin/dotnet as the entrypoint, and --info as the default argument.

Use as a base

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 Hello World web application image on top of a dotnet-aspnet image:

For rocks (9.0-25.04 and later)

bash
# Clone an existing sample of a .NET Core MVC web app
$ git clone https://github.com/Azure-Samples/dotnetcore-docs-hello-world
$ cd dotnetcore-docs-hello-world

# Let's make sure we use a commit that was designed to work with .NET10.0
$ git checkout 64b101351a364dd1e0c845b64013507e855a6e08

Create a Dockerfile with the following content:

Dockerfile
FROM ubuntu:26.04 AS builder

# install the .NET 10 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 dotnet10 ca-certificates

# add your application code
WORKDIR /source
# using https://github.com/Azure-Samples/dotnetcore-docs-hello-world
COPY . .

# publish your ASP.NET app
RUN dotnet publish -c Release --self-contained false -o /app

FROM ubuntu/dotnet-aspnet:10.0-26.04_edge

WORKDIR /app
COPY --from=builder /app ./

CMD ["exec", "dotnet", "/app/dotnetcoresample.dll"]

Build and run the image with the following commands:

bash
$ docker build -t dotnet-hello-world .
$ docker run --rm -p 8080:8080 dotnet-hello-world

Access your web app at localhost:8080.

For Legacy images (6.0, 8.0, 9.0-24.10)

bash
# Clone an existing sample of a .NET Core MVC web app
$ git clone https://github.com/Azure-Samples/dotnetcore-docs-hello-world
$ cd dotnetcore-docs-hello-world

# Let's make sure we use a commit that was designed to work with .NET8.0
$ git checkout 95b862ca3580c82835322d9eb45eb9ecfd731370

Create a Dockerfile with the following content:

Dockerfile
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
# using https://github.com/Azure-Samples/dotnetcore-docs-hello-world
COPY . .

# publish your ASP.NET app
RUN dotnet publish -c Release -o /app --self-contained false

FROM ubuntu.azurecr.io/dotnet-aspnet:8.0-24.04_stable

WORKDIR /app
COPY --from=builder /app ./

ENV PORT 8080
EXPOSE 8080

ENTRYPOINT ["dotnet", "/app/dotnetcoresample.dll"]

Build and run the image with the following commands:

bash
$ docker build -t dotnet-hello-world .
$ docker run --rm -p 8080:8080 dotnet-hello-world

Access your web app at localhost:8080.

Get logs

To view the logs of the running container, run:

sh
docker exec dotnet-aspnet-container pebble logs

Or, for a specific service:

sh
docker exec dotnet-aspnet-container pebble logs <service>
For an older version that is not a rock

To view the logs of the running container, run:

sh
docker logs dotnet-aspnet-container

Monitor health checks

Rocks may have predefined health checks that you can list by running:

sh
docker exec dotnet-aspnet-container pebble checks

The overall health of your container can be inspected via:

sh
docker exec dotnet-aspnet-container pebble health

Configuration

Environment variables

OptionDescriptionDefault
TZContainer timezoneNone
DOTNET_SYSTEM_GLOBALIZATION_INVARIANTWhether to use invariant globalization mode.true
ASPNETCORE_URLSThe URLs that the ASP.NET Core app should listen on.http://+:8080

\https://github.com/canonical/dotnet-aspnet-rock/issues\] \https://github.com/canonical/dotnet-aspnet-rock\]

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 https://canonical.com/legal/intellectual-property-policy.

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 dotnet-aspnet 镜像标签

docker pull docker.xuanyuan.run/ubuntu/dotnet-aspnet:<标签>

DockerHub 原生拉取命令

docker pull ubuntu/dotnet-aspnet:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告