dotnet-deps

ubuntu/dotnet-deps Docker Image

用于自包含.NET和ASP.NET应用的精简Ubuntu镜像,由Canonical提供长期支持版本维护,仅包含必要运行时依赖,接收安全更新并滚动至新版本。

16 次收藏下载次数: 0状态:社区镜像维护者:Ubuntu 官方镜像仓库类型:镜像最近更新:21 小时前

***led Ubuntu for dotnet-deps

当前的dotnet-deps Docker镜像由https://ubuntu.com/security/docker-images提供,基于Ubuntu构建。该镜像会接收安全更新,并滚动更新至新版本的dotnet-deps或Ubuntu发行版。**本仓库可免费使用,且不受每用户速率限制影响。**

关于dotnet-deps

***led Ubuntu for .NET Deps镜像是一个纯净的基础镜像,供开发人员叠加自包含的.NET和ASP.NET应用。详情可参阅.NET文档。该镜像仅包含运行标准自包含.NET应用所需的运行时依赖:ca-certificates、libc6、libgcc、libssl3、libstdc++6和zlib1g。

关于精简Ubuntu容器

此镜像不包含bash或包管理器。
如需了解更多关于.NET的精简Ubuntu(一种新型OCI镜像),请访问https://ubuntu.com/blog/install-dotnet-on-ubuntu。

Canonical与Microsofthttps://ubuntu.com/blog/install-dotnet-on-ubuntu提供并支持Ubuntu上的.NET。

若需.NET或ASP.NET运行时镜像,请查看ubuntu/dotnet-runtime和ubuntu/dotnet-aspnet仓库。

标签与架构

LTS频道提供长达5年的免费安全维护。

ESM提供长达10年的客户安全维护,https://ubuntu.com/security/docker-images#get-in-touch。

频道标签支持截止日期当前版本架构
8.0-24.04_stable8.0, 8.0-24.04_154, 8.0-24.04_beta, 8.0-24.04_beta_154, 8.0-24.04_candidate, 8.0-24.04_candidate_154, 8.0-24.04_edge, 8.0-24.04_edge_154, 8.0-24.04_stable_154, 8.0_beta, 8.0_candidate, 8.0_edge, 8.0_stable, beta, candidate, edge, stable2026年11月Ubuntu 24.04 LTS上的dotnet-deps 8.0amd64, arm64, ppc64le, s390x
9.0-25.04_edge9.0-25.04_edge2026年1月Ubuntu 25.04上的dotnet-deps 9.0arm64, amd64
track_risk

频道标签按稳定性排序:stable、candidate、beta、edge。风险更高的频道始终隐含可用,例如若列出beta,则也可拉取edge;若列出candidate,则可拉取beta和edge;若列出stable,则四个频道均可用。镜像会按edge→beta→candidate→stable的顺序更新。

商业用途与扩展安全维护频道

若您的使用涉及商业再分发,或需要ESM或未列出的频道/版本,请https://ubuntu.com/security/docker-images#get-in-touch(或发送邮件至***)。

使用方法

本地启动镜像

sh
docker run -d --name dotnet-deps-container -e TZ=UTC docker.xuanyuan.run/ubuntu/dotnet-deps:8.0-24.04_stable

对于标签为6.0、8.0和9.0-24.10的镜像,您将看到以下输出:

docker: Error response from daemon: No command specified.
See 'docker run --help'.

这是正常现象,因为该镜像没有入口点。

对于标签为9.0-25.04及以上的镜像,您将看到以下输出:

2025-07-17T15:12:33.628Z [pebble] Started daemon.
2025-07-17T15:12:33.653Z [pebble] POST /v1/services 151.275µs 400 (http+unix)
2025-07-17T15:12:33.653Z [pebble] Cannot start default services: no default services

这是因为该镜像是Rock,默认入口点为https://documentation.ubuntu.com/rockcraft/en/latest/explanation/pebble/#pebble-explanation-page,且Rock中未定义默认服务。

叠加自包含.NET应用

dotnet-deps镜像的主要用途是提供基础依赖,以便在其之上叠加自包含的.NET或ASP.NET应用。

以下是多阶段Dockerfile示例:基于Ubuntu 24.04构建ASP.NET应用,并将其打包到ubuntu/dotnet-deps:8.0-24.04_stable之上。

Dockerfile
FROM docker.xuanyuan.run/ubuntu:24.04 AS builder

# 从Ubuntu仓库安装.NET 8 SDK
# (无需清理apt缓存,因为此阶段不发布)
RUN apt-get update && apt-get install -y dotnet8 ca-certificates

# 添加应用代码
WORKDIR /source
# 使用示例应用:https://github.com/Azure-Samples/dotnetcore-docs-hello-world
COPY . .

# 导出自包含.NET应用
RUN dotnet publish -c Release -r ubuntu.24.04-x64 --self-contained true -o /app

FROM docker.xuanyuan.run/ubuntu/dotnet-deps:8.0-24.04_stable

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

ENTRYPOINT ["/app/dotnetcoresample"]

使用上述Dockerfile构建并运行:

bash
git clone https://github.com/Azure-Samples/dotnetcore-docs-hello-world.git
cd dotnetcore-docs-hello-world
git checkout 95b862ca3580c82835322d9eb45eb9ecfd731370
# 将上述示例内容复制到./Dockerfile
docker build . -t my-chiseled-aspnet-app:latest
docker run -p 8080:8080 docker.xuanyuan.run/my-chiseled-aspnet-app:latest
# 访问 http://localhost:8080/

.NET 9应用示例

如需构建.NET 9应用并打包到ubuntu/dotnet-deps:9.0-25.04_edge之上,可使用以下Dockerfile:

Dockerfile
FROM docker.xuanyuan.run/ubuntu:25.04 AS builder

# 从Ubuntu仓库安装.NET 9 SDK
# (无需清理apt缓存,因为此阶段不发布)
RUN apt-get update && apt-get install -y dotnet9 ca-certificates

# 添加应用代码
WORKDIR /source
# 使用示例应用:https://github.com/Azure-Samples/dotnetcore-docs-hello-world
COPY . .

# 导出自包含.NET应用
RUN dotnet publish -c Release -r ubuntu.25.04-x64 --self-contained true -o /app

FROM docker.xuanyuan.run/ubuntu/dotnet-deps:9.0-25.04_edge

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

CMD ["exec", "/app/dotnetcoresample"]

运行命令:

bash
git clone https://github.com/Azure-Samples/dotnetcore-docs-hello-world.git
cd dotnetcore-docs-hello-world
git checkout 95b862ca3580c82835322d9eb45eb9ecfd731370
sed -i 's/net8.0/net9.0/' dotnetcoresample.csproj
# 将上述示例内容复制到./Dockerfile
docker build . -t my-chiseled-aspnet-app:latest
docker run -p 8080:8080 docker.xuanyuan.run/my-chiseled-aspnet-app:latest
# 访问 http://localhost:8080/

测试与调试

查看容器日志:

sh
docker logs -f dotnet-deps-container

Bug与功能请求

如发现镜像bug或需请求功能,请提交bug报告:

https://bugs.launchpad.net/ubuntu-docker-images/+filebug

请将bug标题格式化为“dotnet-deps: <问题摘要>”,并包含所用镜像的摘要(通过以下命令获取):

sh
docker images --no-trunc --quiet ubuntu/dotnet-deps:<tag>

已弃用频道与标签

以下频道(标签)不再更新。请升级至新频道,如无法升级,请https://ubuntu.com/security/docker-images#get-in-touch。

跟踪版本终止支持日期升级路径
9.0-24.10Ubuntu 24.10上的dotnet-deps 9.02025年7月-
6.0-22.04Ubuntu 22.04 LTS上的dotnet-deps 6.02024年11月-
7.0-23.04Ubuntu 23.04上的dotnet-deps 7.02024年5月-
6.0-22.10Ubuntu 22.10上的dotnet-deps 6.02023年7月-
7.0-23.04Ubuntu 23.04上的dotnet-deps 7.02024年5月-
6.0-22.10Ubuntu 22.10上的dotnet-deps 6.02023年7月-
7.0-22.10Ubuntu 22.10上的dotnet-deps 7.02023年7月-
track

镜像拉取方式

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

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

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

DockerHub 原生拉取命令

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