交互式 .Net 容器版有哪些具体应用场景?

2026-05-25 19:531阅读0评论SEO基础
  • 内容介绍
  • 相关推荐

本文共计417个文字,预计阅读时间需要2分钟。

交互式 .Net 容器版有哪些具体应用场景?

背景介绍+之前的文章+交互式+.Net中已经介绍了什么是交互式。文中通过Visual Studio Code插件的方实现交互式.Net。现在,我们将使用容器的方式实现交互式.Net。图像构建

背景介绍

在之前的文章 -交互式 .Net中已经介绍了什么是交互式 .Net,文中是通过 Visual Studio Code 插件的方式实现交互式 .Net 的。现在,我们将使用容器的方式实现交互式 .Net。

交互式 .Net 容器版有哪些具体应用场景?

镜像构建

1. Dockerfile

FROM mcr.microsoft.com/dotnet/sdk:6.0-focal ARG HTTP_PORT_RANGE=1100-1200 # Opt out of telemetry until after we install jupyter when building the image, this prevents caching of machine id ENV DOTNET_INTERACTIVE_CLI_TELEMETRY_OPTOUT=true # Install all OS dependencies for notebook server that starts but lacks all # features (e.g., download as all possible file formats) ENV DEBIAN_FRONTEND noninteractive RUN sed -i 's|[^/]\+/|mirrors.aliyun.com/|' /etc/apt/sources.list RUN apt-get update \ && apt-get install -yq --no-install-recommends \ wget \ bzip2 \ ca-certificates \ sudo \ locales \ fonts-liberation \ run-one \ python3.8 \ python3-pip \ && apt-get clean && rm -rf /var/lib/apt/lists/* RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ locale-gen RUN python3 -m pip install setuptools RUN python3 -m pip install jupyter RUN python3 -m pip install jupyterlab # Add package sources RUN dotnet nuget add source "pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" -n "dotnet-tools" RUN dotnet nuget add source "pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" -n "dotnet6" RUN dotnet nuget add source "pkgs.dev.azure.com/dnceng/public/_packaging/MachineLearning/nuget/v3/index.json" -n "MachineLearning" # Install lastest build from master branch of Microsoft.DotNet.Interactive RUN dotnet tool install --tool-path /usr/share/dotnet-interactive Microsoft.dotnet-interactive --add-source "pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" RUN ln -s /usr/share/dotnet-interactive/dotnet-interactive /usr/bin/dotnet-interactive RUN dotnet interactive jupyter install --github.com/dotnet/interactive

如果大家有什么问题,欢迎在文章或者在公众号 - 跬步之巅留言交流。

本文共计417个文字,预计阅读时间需要2分钟。

交互式 .Net 容器版有哪些具体应用场景?

背景介绍+之前的文章+交互式+.Net中已经介绍了什么是交互式。文中通过Visual Studio Code插件的方实现交互式.Net。现在,我们将使用容器的方式实现交互式.Net。图像构建

背景介绍

在之前的文章 -交互式 .Net中已经介绍了什么是交互式 .Net,文中是通过 Visual Studio Code 插件的方式实现交互式 .Net 的。现在,我们将使用容器的方式实现交互式 .Net。

交互式 .Net 容器版有哪些具体应用场景?

镜像构建

1. Dockerfile

FROM mcr.microsoft.com/dotnet/sdk:6.0-focal ARG HTTP_PORT_RANGE=1100-1200 # Opt out of telemetry until after we install jupyter when building the image, this prevents caching of machine id ENV DOTNET_INTERACTIVE_CLI_TELEMETRY_OPTOUT=true # Install all OS dependencies for notebook server that starts but lacks all # features (e.g., download as all possible file formats) ENV DEBIAN_FRONTEND noninteractive RUN sed -i 's|[^/]\+/|mirrors.aliyun.com/|' /etc/apt/sources.list RUN apt-get update \ && apt-get install -yq --no-install-recommends \ wget \ bzip2 \ ca-certificates \ sudo \ locales \ fonts-liberation \ run-one \ python3.8 \ python3-pip \ && apt-get clean && rm -rf /var/lib/apt/lists/* RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ locale-gen RUN python3 -m pip install setuptools RUN python3 -m pip install jupyter RUN python3 -m pip install jupyterlab # Add package sources RUN dotnet nuget add source "pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" -n "dotnet-tools" RUN dotnet nuget add source "pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" -n "dotnet6" RUN dotnet nuget add source "pkgs.dev.azure.com/dnceng/public/_packaging/MachineLearning/nuget/v3/index.json" -n "MachineLearning" # Install lastest build from master branch of Microsoft.DotNet.Interactive RUN dotnet tool install --tool-path /usr/share/dotnet-interactive Microsoft.dotnet-interactive --add-source "pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" RUN ln -s /usr/share/dotnet-interactive/dotnet-interactive /usr/bin/dotnet-interactive RUN dotnet interactive jupyter install --github.com/dotnet/interactive

如果大家有什么问题,欢迎在文章或者在公众号 - 跬步之巅留言交流。