Reputation: 617
I have looked at other posts related to this and couldn't resolve the issue.
Docker File:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY webapp/*.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY ./webapp ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT [ "dotnet", "weppapp.dll" ]
Local version of .NET Core:
PS C:\Repository\AzureCLIScripts\AZ203\ContainerizedSolutions> dotnet --version
3.1.201
I'm following along a training course on Docker, primarily related to the AZ-203 course, so I'm sure the original code is for .NET Core 2.1. I've researched as best I can, but can't seem to get the app to run inside of docker, when it runs fine locally.
When I run the following I get the error below:
PS C:\Repository\AzureCLIScripts\AZ203\ContainerizedSolutions> docker run -p 8081:80 --name mywebapp webapp
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
Any suggestions?
Upvotes: 0
Views: 3218
Reputation: 151
This happened to me when I changed the assembly name in the project but forgot to change it in the Dockerfile. Assembly name is in the project properties.
Upvotes: 3