Docker Alpine container exit code 139
Reproduction steps
I'm running this Dockerfile with a project that uses libgit2sharp.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine as base
EXPOSE 80
VOLUME /etc/nginx
VOLUME /etc/ssl
VOLUME /myproject
ADD tools/ssl/myproject* /etc/ssl/
# Install git.
RUN apk update && apk upgrade && \
apk add --no-cache git openssh nano
# Build WebSite.
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build
# Install nodejs.
RUN apk update && apk upgrade && \
apk add --no-cache npm
# Copy everything and publish app
WORKDIR /src
COPY ./src/. .
WORKDIR /src/MyProject/WebSite
RUN dotnet publish -c release -o /app
# Final stage/image
FROM base as final
WORKDIR /app
COPY --from=build /app ./
ENTRYPOINT ["dotnet", "MyProject.WebSite.dll"]
Expected behavior
No crash.
Actual behavior
Docker container exits with code 139. There is nothing being logged from .NET. try/catch is not handling anything. There is no information in docker info. There are no logs in docker itself. I have absolutely no idea why this is crashing.
I'm using this Dockerfile for debugging in Visual Studio.
# This dockerfile is used for debugging in Visual Studio.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine
EXPOSE 80
VOLUME /etc/nginx
VOLUME /etc/ssl
VOLUME /myproject
RUN apk update && \
apk add --no-cache nodejs npm git openssh
ADD keys/. /root/.ssh/
RUN chmod 600 /root/.ssh/*
Everything works fine here. It's running in the same container OS. The only difference is everything is built inside the container for the image, whereas debugging everything is built then copied in.
I don't know how to figure out what's going wrong at this point.
Version of LibGit2Sharp (release number or SHA1)
0.27.0.-preview-0034
Operating system(s) tested; .NET runtime tested
Docker container mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine
I just tried publishing and copying the files in instead of building in the container and I have the same result.
The server where this isn't working is Ubuntu 18.04, though I don't know why that would make a difference since it's running in a container. It works locally in Docker Desktop for Windows running Linux containers.
I'll try some other container distributions besides Alpine and see if any others work.
Just confirmed it works fine in mcr.microsoft.com/dotnet/core/aspnet:3.1-bionic
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-bionic as base
EXPOSE 80
VOLUME /etc/nginx
VOLUME /etc/ssl
VOLUME /myproject
ADD tools/ssl/myproject* /etc/ssl/
# Install git.
RUN apt-get update && \
apt-get install -y git nano
# Build WebSite.
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic AS build
# Install nodejs.
RUN apt-get update && \
#apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_12.x | bash && \
apt-get install -y nodejs
# Copy everything and publish app
WORKDIR /src
COPY ./src/. .
WORKDIR /src/MyProject/WebSite
RUN dotnet publish -c release -o /app
# Final stage/image
FROM base as final
WORKDIR /app
COPY --from=build /app ./
ENTRYPOINT ["dotnet", "MyProject.WebSite.dll"]
I'm running into this problem running natively on Ubuntu 22.04. It seems to happen whenever I try to access the Author or Committer signatures of a commit, i.e. whenever the lazyAuthor or lazyCommitter members are evaluated.
Edit: The error occurs when any lazy members are evaluated after the Repository instance has been disposed. Perhaps this would be resolved by an object lifetime check in the ILazy implementation, throwing a more helpful Exception?