Linux docker映像上的多个dotnet核心版本

编程入门 行业动态 更新时间:2024-10-24 19:28:24
本文介绍了Linux docker映像上的多个dotnet核心版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想知道如何在Linux上的Docker容器中运行和安装dotnet核心框架2.1和1.1的多个版本。下面是我当前的dockerfile,我也想向其中添加dotnet 1.1

I want to know how i can run and install multilple version of the dotnet core framework 2.1 and 1.1 in a docker container on linux. Below is my current dockerfile and i want to add dotnet 1.1 to it as well

FROM microsoft/dotnet:2.1.403-sdk-bionic ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE true ENV DOTNET_CLI_TELEMETRY_OPTOUT true RUN apt-get update && \ apt-get install -y zip

推荐答案

这是多个dotnet核心框架的示例。

Here is an example of multiple dotnet core framework.

FROM microsoft/dotnet:2.2-runtime-deps-stretch-slim RUN apt-get update \ && apt-get install -y --no-install-recommends \ curl \ wget \ gpg \ apt-transport-https \ && rm -rf /var/lib/apt/lists/* RUN apt-get update # Install .NET Core Runtime v1.1.2 ENV DOTNET_VERSION 1.1.2 ENV DOTNET_DOWNLOAD_URL dotnetcli.blob.core.windows/dotnet/release/1.1.0/Binaries/$DOTNET_VERSION/dotnet-debian-x64.$DOTNET_VERSION.tar.gz RUN curl -SL $DOTNET_DOWNLOAD_URL --output dotnet.tar.gz \ && mkdir -p /usr/share/dotnet \ && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ && rm dotnet.tar.gz \ && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet # Install ASP.NET Core ENV ASPNETCORE_VERSION 2.2.1 RUN curl -SL --output aspnetcore.tar.gz dotnetcli.blob.core.windows/dotnet/aspnetcore/Runtime/$ASPNETCORE_VERSION/aspnetcore-runtime-$ASPNETCORE_VERSION-linux-x64.tar.gz \ && aspnetcore_sha512='e027a5dada5d139a44675f28090f996375e49fbd72f7897aa925e48803632d5bf187d4f22dc8225505ac33e6a7a05dcdd8ed19d8b6d5e46b22e628315cf13e3e' \ && echo "$aspnetcore_sha512 aspnetcore.tar.gz" | sha512sum -c - \ && mkdir -p /usr/share/dotnet \ && tar -zxf aspnetcore.tar.gz -C /usr/share/dotnet \ && rm aspnetcore.tar.gz \ && ln -sf /usr/share/dotnet/dotnet /usr/bin/dotnet

这是来自实例内部的结果

And here is the result from within the instance

root@cb87fda4dfc7:/# dotnet --info Host (useful for support): Version: 2.2.1 Commit: 878dd11e62 .NET Core SDKs installed: No SDKs were found. .NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

更多推荐

Linux docker映像上的多个dotnet核心版本

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

发布评论

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

>www.elefans.com

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