.net web api with docker Could not execute because the application was not found or a compatible .NET SDK is not installed

Viewed 420

I am trying to run a .net web api on docker but it won't work. I have already tried the link below and it won't work.

Could not execute because the application was not found or a compatible .NET SDK is not installed

I have also tried installing the .NET 5 SDK. Running the command 'dotnet' also works. Below is my docker file.

FROM mcr.microsoft.com/dotnet/aspnet:5.0-focal AS base
WORKDIR /app
EXPOSE 80

ENV ASPNETCORE_URLS=http://+:80

FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS build
WORKDIR /src
COPY ["Catalog.csproj", "./"]
RUN dotnet restore "Catalog.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet publish "Catalog.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "Catalog.dll"]

And I am trying to run it using the following command.

docker run -it --rm -p 8080:80 -e MongoDbSettings:Host=mongo -e MongoDbSettings:Password=mypass --network=net5tutorial catalog:v1

This is my complete error message

Could not execute because the application was not found or a compatible .NET SDK is not installed.
Possible reasons for this include:
  * You intended to execute a .NET program:
      The application 'Catalog.dll' does not exist.
  * You intended to execute a .NET SDK command:
      It was not possible to find any installed .NET SDKs.
      Install a .NET SDK from:
        https://aka.ms/dotnet-download

I hope you can help me, I am on a Mac should this be of any importance. Thanks in advance

0 Answers
Related