ASP.NET Core 7.0 container: Failed to create CoreCLR, HRESULT: 0x8007000E
Asked Answered
I

1

7

That's a result when I receive after trying to run ASP.NET Core 7.0 runtime image in Amazon ECS container (AWS Fargate service).

My project in on ASP.NET Core 7.0 Web API.

Here is a docker file for image which built on Jenkins and sent to Amazon ECS

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["src/MetaGame/MyMetaGame.API/MyMetaGame.API.csproj", "src/MetaGame/MyMetaGame.API/"]
RUN dotnet restore "src/MetaGame/MyMetaGame.API/MyMetaGame.API.csproj"
COPY . .
WORKDIR "/src/src/MetaGame/MyMetaGame.API"
RUN dotnet build "MyMetaGame.API.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "MyMetaGame.API.csproj" -c Release -o /app/publish /p:UseAppHost=false

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

After some googling I've found a decision to increase GC Heap limit by environment parameter. I set it to 512Mb

DOTNET_GCHeapHardLimit=20000000

But it hasn't fixed my problem. No idea what's the problem Here is the configuration of csproj file

<PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
Indomitability answered 1/6, 2023 at 15:30 Comment(2)
@SergeyBoiko have u tried ENV COMPlus_EnableDiagnostics=0 in final state of Docker file before WORKDIR command?Indomitability
Sergey, on our side "Read only root file system: true" caused that problemRaft
I
5

So, the problem is fixed by adding

ENV COMPlus_EnableDiagnostics=0

in the final stage of Dockerfile. So, it should looks like

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

Found the solution here

Indomitability answered 1/6, 2023 at 18:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.