Hi,
I am getting the following error when deploying donet core 3.0 with docker:
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/app/'.
This is my Dockerfile:
`
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
WORKDIR /app
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
WORKDIR /src
COPY ["TestCloudRun.csproj", "TestCloudRun/"]
RUN dotnet restore "TestCloudRun/TestCloudRun.csproj"
COPY . .
WORKDIR "/src/TestCloudRun"
RUN dotnet build "TestCloudRun.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "TestCloudRun.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TestCloudRun.dll"]
`
This is the repo: https://github.com/avifatal/core3deployment-issue
I should mention that I'm deploying to google cloud run.
Thanks
You have
<OutputType>Library</OutputType>
in your project file, but it has to be
<OutputType>Exe</OutputType>
with ENTRYPOINT ["dotnet", "TestCloudRun.dll"], shouldn't it be a library? EXE doesn't even make sense for Linux.
Same issue for my web app in .net core 3.1 app
I am facing same issue with .net core app using below base image.
FROM mcr.microsoft.com/dotnet/core/runtime:2.1-stretch-slim AS base
FROM mcr.microsoft.com/dotnet/core/sdk:2.1-stretch AS build
the same issue here when running on a linux machine (ubuntu 20.04) from a docker container.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-focal
same problem on docker for windows (linux container) for self contrained .net core 3.1 app
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1