.NET 5的Docker映像

编程入门 行业动态 更新时间:2024-10-28 06:26:42
本文介绍了.NET 5的Docker映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

出于实验原因,我启动了一个新的 5项目,并使用以下代码创建了 dockerfile

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

,并出现以下问题:

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

解决方案

当我阅读

图片说明:

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

图像描述参考.

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

FROM mcr.microsoft/dotnet/core/aspnet:3.1-buster-slim AS base FROM mcr.microsoft/dotnet/core/sdk:3.1-buster AS build

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

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

and have following issue:

=> ERROR [internal] load metadata for mcr.microsoft/dotnet/core/sdk:5.0-buster 0.2s => ERROR [internal] load metadata for mcr.microsoft/dotnet/core/aspnet:5.0-buster-slim 0.2s => CANCELED [build 1/7] FROM mcr.microsoft/dotnet/core/sdk:5.0-buster 0.0s => => resolve mcr.microsoft/dotnet/core/sdk:5.0-buster 0.0s => [internal] load build context 0.0s => ERROR [base 1/2] FROM mcr.microsoft/dotnet/core/aspnet:5.0-buster-slim 0.0s => => resolve mcr.microsoft/dotnet/core/aspnet:5.0-buster-slim

解决方案

As I read here, it is changed to:

FROM mcr.microsoft/dotnet/aspnet:5.0-buster-slim AS base FROM mcr.microsoft/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/dotnet/runtime:5.0 .NET 5 multi-architecture: Supports Linux and Windows Nano Server depending on the Docker host.
mcr.microsoft/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/dotnet/aspnet:5.0-buster-slim .NET 5 runtime-only on Linux Debian distro
mcr.microsoft/dotnet/aspnet:5.0-nanoserver-1809 .NET 5 runtime-only on Windows Nano Server (Windows Server version 1809)

Image description reference.

更多推荐

.NET 5的Docker映像

本文发布于:2023-11-13 23:07:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585572.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:映像   NET   Docker

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!