Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
811 views
in Technique[技术] by (71.8m points)

containers - How to Install .netcore sdk in azure batch node

I have .net core Console Application, which prints a basic hello world message. I have published my application to azure container registry.

my Docker File:

FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["ConsoleApp1.csproj", ""]
RUN dotnet restore "./ConsoleApp1.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "ConsoleApp1.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "ConsoleApp1.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ConsoleApp1.dll"]

I have created a node, please go through this image for better understanding: node-configuration1 ,node-configuration,node-config,task-config

I am using a Linux container for integrating with azure batch, but whenever I run My task its saying to install

It was not possible to find any installed .NET Core SDKs
  Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
      https://aka.ms/dotnet-download**

Task_issue

How do I install dotnet core in a linux container?

Please guide me on this, through sharing some examples.

question from:https://stackoverflow.com/questions/65884159/how-to-install-netcore-sdk-in-azure-batch-node

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

By default, the working directory for Azure Batch tasks is set to a path that is preset according to the job and task and in a well-known location on the VM. This directory can be referenced by the environment variable AZ_BATCH_TASK_WORKING_DIR.

If you want to explicitly set the working directory of the container as specified by the container image/Dockerfile upon execution of the container, then you should set the WorkingDirectory of the TaskContainerSettings object to ContainerImageDefault.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...