How to run an ASP .NET 6 API in a docker container on a raspberry pi / armv7

Viewed 45

If I deploy my API directly I can start it via dotnet <app.dll>. I want to deploy it in a container tho. However, the container always exits with an error code 132 or 130 depending on the Dockerfile used. I will post it here:

FROM mcr.microsoft.com/dotnet/aspnet:3.1-bullseye-slim-arm32v7 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["API/API.csproj", "API/"]
RUN dotnet restore "API/API.csproj"
COPY . .
WORKDIR "/src/API"
RUN dotnet build "API.csproj" -c Release -o /app/build -r linux-arm


FROM build AS publish
RUN dotnet publish "API.csproj" -c Release -o /app/publish -r linux-arm

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "API.dll"]

The first line of this Dockerfile is what I have been changing up in order to "find" the correct runtime. I tried many containers listed here at the Linux arm32 Tags section. All containers I tried exit with an error immediately: enter image description here

I would greatly appreciate any help on how to resolve this issue :)

EDIT: I use a raspberry pi 4 Model B with 8GB of RAM

0 Answers
Related