So none of the above answers worked for me, but I finally found the problem, it was something in the .csproj file of the API, and it was causing the docker container hosting the API not to start with the message in the thread title.
This was the line that had been added in PropertyGroup
node, presumably when someone had published the file for windows, and then checked in the updated .csproj
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
As it turns out this is a publish option. Removing this sets the project to a default value of portable (in the UI) which is "any" in the file if it were explicitly specified. Removing the line above fixed the problem for me.
Edit
As a side note, I was able to leave the RuntimeIdentifier
in the API .csproj file alone (kept win-x64
value) by changing my Dockerfile dotnet publish args to:
RUN dotnet publish ./src/API.csproj --self-contained --runtime linux-musl-x64 --configuration Release --output /app/publish
The important parts being the addition of --self-contained
and --runtime linux-musl-x64
for alpine-linux ... this image: mcr.microsoft.com/dotnet/aspnet:3.1-alpine
The build image for this is mcr.microsoft.com/dotnet/sdk:3.1