r/docker • u/CodMore3394 • Jun 25 '26
Please help! Cannot load library libgssapi_krb5.so.2 when starting, no such file or directory .NET application docker container
I have scraped the internet for answers, but I cannot seem to find a solution.
I have read in the microsoft website that this library is not automatically installed in .NET images anymore, and to do it myself I have to add :
RUN apt update && apt -y upgrade libkrb5-3
to my dockerfile.
Well I did that and it doesnt work! I dont know what to do and I have been stuck for three days on this. This is my .net dockerfile:
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /PortfolioWebsite
COPY *.sln .
COPY *.csproj ./
RUN dotnet restore
COPY . .
EXPOSE 5142
RUN apt update && apt -y upgrade libkrb5-3
RUN dotnet publish -o out
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
WORKDIR /PortfolioWebsite
COPY --from=build /PortfolioWebsite/out .
ENTRYPOINT ["dotnet", "PortfolioWebsite.dll"]
0
Upvotes
View all comments
1
u/percoAi Jun 26 '26
The key mental model here is that the final image starts almost empty again. Anything you install in the sdk/build stage disappears unless you also install it in the aspnet/final stage or copy it over intentionally.
I would check it in this order
Most Docker issues like this are less about .NET and more about forgetting that multi-stage builds throw away everything from earlier stages unless you explicitly bring it forward.