.net 5 的 Docker 镜像

标签 docker .net-5

通常我将以下图像用于 .net core 3.1 并且它工作正常。

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
我出于实验原因启动了一个新的 .net 5 项目并创建了 dockerfile与以下
FROM mcr.microsoft.com/dotnet/core/aspnet:5.0-buster-slim AS base 
FROM mcr.microsoft.com/dotnet/core/sdk:5.0-buster AS build
并有以下问题:
 => ERROR [internal] load metadata for mcr.microsoft.com/dotnet/core/sdk:5.0-buster                           0.2s
 => ERROR [internal] load metadata for mcr.microsoft.com/dotnet/core/aspnet:5.0-buster-slim                   0.2s
 => CANCELED [build 1/7] FROM mcr.microsoft.com/dotnet/core/sdk:5.0-buster                                    0.0s
 => => resolve mcr.microsoft.com/dotnet/core/sdk:5.0-buster                                                   0.0s
 => [internal] load build context                                                                             0.0s
 => ERROR [base 1/2] FROM mcr.microsoft.com/dotnet/core/aspnet:5.0-buster-slim                                0.0s
 => => resolve mcr.microsoft.com/dotnet/core/aspnet:5.0-buster-slim

最佳答案

当我阅读时 here ,改为:

FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
docker hub上也提到了与 more info :

As part of the .NET 5.0 release, all .NET Docker images (including .NET Core 2.1 and 3.1) have transitioned to a new set of Docker repositories described below. Updates will continue to be made to supported tags in the old repository locations for backwards compatibility. Please update any repository references to these new names. For more information see the .NET 5.0 repository rename announcement.


enter image description here

编辑:
图片说明:


图片
注释


mcr.microsoft.com/dotnet/runtime:5.0
.NET 5 多架构:支持 Linux 和 Windows Nano Server,具体取决于 Docker 主机。

mcr.microsoft.com/dotnet/aspnet:5.0
ASP.NET Core 5.0 多架构:支持 Linux 和 Windows Nano Server,具体取决于 Docker 主机。 aspnetcore 镜像对 ASP.NET Core 进行了一些优化。

mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim
在 Linux Debian 发行版上仅运行 .NET 5

mcr.microsoft.com/dotnet/aspnet:5.0-nanoserver-1809
.NET 5 仅运行时在 Windows Nano Server(Windows Server 版本 1809)上


图片说明 reference .

关于.net 5 的 Docker 镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64844197/

相关文章:

docker - "Empty continuation lines will become errors"...我现在应该如何评论我的Dockerfile?

c# - ASP NET Core Web API 禁用 TLS 1.0 和 TLS 1.1 支持

mongodb - 无法使用 mongo 连接到 docker 容器

docker - Kubernetes docker 容器中的前端 Vue.js 应用程序无法连接到后端

docker - 无法在 Kubernetes 中的 Grafana 仪表板中获取 Prometheus 数据

c# - 使用 Windows.System 命名空间添加 CsWinRT nuget 中断

c# - Blazor Wasm - 无法从 'method group' 转换为 'EventCallback'

docker - 为您的容器化应用程序提供自定义命令行工具的最佳实践是什么?

visual-studio-2019 - 当出现错误时,EnforceCodeStyleInBuild true 不会使构建失败

c# - 如何使用 System.Text.Json 访问从字符串反序列化的动态对象的属性?