.net 5 的 Docker 镜像 [英] Docker image for .net 5

查看:31
本文介绍了.net 5 的 Docker 镜像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base从 mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS 构建

出于实验原因,我开始了一个新的 .net 5 项目,并使用以下内容创建了 dockerfile

FROM mcr.microsoft.com/dotnet/core/aspnet:5.0-buster-slim AS base从 mcr.microsoft.com/dotnet/core/sdk:5.0-buster AS 构建

并有以下问题:

 =>错误 [内部] 加载 mcr.microsoft.com/dotnet/core/sdk:5.0-buster 0.2s 的元数据=>错误 [内部] 加载 mcr.microsoft.com/dotnet/core/aspnet:5.0-buster-slim 0.2s 的元数据=>从 mcr.microsoft.com/dotnet/core/sdk:5.0-buster 0.0s 取消 [build 1/7]=>=>解析 mcr.microsoft.com/dotnet/core/sdk:5.0-buster 0.0s=>[内部] 加载构建上下文 0.0s=>错误 [base 1/2] 来自 mcr.microsoft.com/dotnet/core/aspnet:5.0-buster-slim 0.0s=>=>解析 mcr.microsoft.com/dotnet/core/aspnet:5.0-buster-slim

解决方案

当我读到


图片说明:

<头>
图片评论
mcr.microsoft.com/dotnet/runtime:5.0.NET 5 多架构:支持 Linux 和 Windows Nano Server,具体取决于 Docker 主机.
mcr.microsoft.com/dotnet/aspnet:5.0ASP.NET Core 5.0 多架构:支持 Linux 和 Windows Nano Server,具体取决于 Docker 主机.aspnetcore 映像对 ASP.NET Core 进行了一些优化.
mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim.NET 5 仅运行时在 Linux Debian 发行版上
mcr.microsoft.com/dotnet/aspnet:5.0-nanoserver-1809.NET 5 仅运行时在 Windows Nano Server(Windows Server 版本 1809)上

图像描述 引用.

Typically I use following images for .net core 3.1 and it works fine.

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

I have for experimental reason started a new .net 5 project and created dockerfile with following

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

and have following issue:

 => 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

解决方案

As I read here, it is changed to:

FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build

It is also mentioned on the docker hub with 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.


EDIT: Image descriptions:

Image Comments
mcr.microsoft.com/dotnet/runtime:5.0 .NET 5 multi-architecture: Supports Linux and Windows Nano Server depending on the Docker host.
mcr.microsoft.com/dotnet/aspnet:5.0 ASP.NET Core 5.0 multi-architecture: Supports Linux and Windows Nano Server depending on the Docker host. The aspnetcore image has a few optimizations for ASP.NET Core.
mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim .NET 5 runtime-only on Linux Debian distro
mcr.microsoft.com/dotnet/aspnet:5.0-nanoserver-1809 .NET 5 runtime-only on Windows Nano Server (Windows Server version 1809)

Image description reference.

这篇关于.net 5 的 Docker 镜像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆