本文介绍了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核心版本
发布评论