通常我将以下图像用于 .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.
编辑:
图片说明:
图片
注释
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/