Ich kann die App erfolgreich in Docker erstellen und veröffentlichen, aber wenn ich versuche, die App zu starten , erhalte ich die folgende Fehlermeldung:
„Sie wollten einen .NET SDK-Befehl ausführen: Es wurden keine .NET SDKs gefunden.“
Um zusätzliche .NET Core-Laufzeiten oder SDKs zu installieren : https://aka.ms/dotnet-download
Hier mein Code:
Code: Select all
FROM mcr-microsoft.com/dotnet/aspnet:8.0-jammy AS base
WORKDIR /app
EXPOSE 80
# Image for build
FROM mcr-microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
copy all files, exclude in dockerignore
COPY . .
RUN dotnet restore -s https://api.nuget.org/v3/index.json "webapp_NET8_Linux.sln"
RUN dotnet publish "webapp_NET8_Linux.sln" --no-restore -c Release -o /app/publish -p:TargetFramework=net8.0
# copy content of Image: build from folder: /app/publish to the base-Image in der app Folder
FROM base
WORKDIR /app
ENV APP_USER app_user
RUN useradd -r $APP_USER
USER $APP_USER
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "webapp.dll"]
Code: Select all
docker run --rm -it --entrypoint /bin/bash 05b6
Code: Select all
dotnet --version
Wenn ich den Docker-Container betrete, kann ich die webapp.dll sehen