.NET 5的Docker映像 [英] Docker image for .net 5

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

问题描述

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

  FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS基础从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基础从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取消[内部版本1/7]=>=>解析mcr.microsoft.com/dotnet/core/sdk:5.0-buster 0.0s=>[内部]负载构建上下文0.0s=>来自mcr.microsoft.com/dotnet/core/aspnet的错误[base 1/2]: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.0 ASP.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天全站免登陆