Segmentation fault running .NET Core 5, Entity Framework application in Docker container with Sqlite

Viewed 426

I am trying to run a .NET Core 5.0 application inside a Docker container that is based on a dotnet:5.0-alpine image but the container crashes with a "Segmentation fault" when the application tries to execute the first Sqlite command. The application is using Entity Framework and dying in the first migration step. The application runs fine outside the container.

I searched and found this issue in dotnet/efcore, which was superseded by this issue in dotnet/runtime but both are over 2 years old. Both issues were closed but I can't figure out if the problem was fixed or if there is a workaround.

The top of my docker file looks like this:

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

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src

COPY . .

...

Has anyone else run into this problem and found a solutions?

I should add the version of packages I'm using:

  • Microsoft.EntityFrameworkCore 5.0.9
  • Microsoft.EntityFrameworkCoreSqlite 5.0.9

I have created a project to reproduce this problem:

git clone repro repo https://github.com/drathnow/SqliteTestApp.git
cd SqliteTestApp/SqliteTestApp
dotnet publish -c Release -v n -o ./obj/Docker/publish SqliteTestApp.csproj
docker build -t sqlitetestapp .
docker run -it --rm sqlitetestapp /bin/sh
dotnet SqliteTestApp.dll
0 Answers
Related