Skip to content

Dockerise ASP.NET Core app with Alpine image #4850

Closed

Description

@javiercn

Issue moved from dotnet/aspnetcore#50399


From @lonix1 on Tuesday, August 29, 2023 3:46:57 PM

I originally asked on SO without resolution. I assume this is not working as intended.


I want my dockerised ASP.NET Core 7 app based on Alpine (not ASP.NET Core Runtime).

MyApp.csproj contains:

<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>linux-musl-x64</RuntimeIdentifier>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>  <!-- tried with and without this -->

Dockerfile contains:

FROM alpine

But when I start a container, I get:

Error relocating /dist/MyApp: __cxa_pure_virtual: symbol not found
Error relocating /dist/MyApp: __cxa_pure_virtual: symbol not found
Error relocating /dist/MyApp: __cxa_pure_virtual: symbol not found
Error relocating /dist/MyApp: _ZTVN10__cxxabiv121__vmi_class_type_infoE: symbol not found
Error relocating /dist/MyApp: _ZTVN10__cxxabiv121__vmi_class_type_infoE: symbol not found
Error relocating /dist/MyApp: _ZTVN10__cxxabiv121__vmi_class_type_infoE: symbol not found

It works with the normal image (i.e. FROM mcr.microsoft.com/dotnet/aspnet).

The docs imply that with the correct RID (linux-musl-x64), this should work. But obviously the generated binary is missing native dependencies.

Activity

  1. javiercn commented on Aug 30, 2023

    @javiercn
    MemberAuthor

    Issue moved from dotnet/aspnetcore#50399


    From @lonix1 on Wednesday, August 30, 2023 1:26:31 AM

    UPDATE:

    The answers in that SO thread explain that the runtime-deps image is needed for various alpine dependencies.

    So this is working properly, but the documentation needs some polish.

    Somewhere in [1] or [2] it should mention that the self-contained single-file app cannot be run in alpine directly, but can be run in runtime-deps.

    Could you possibly move this to the docs repo?

  2. javiercn commented on Aug 30, 2023

    @javiercn
    MemberAuthor

    Issue moved from dotnet/aspnetcore#50399


    From @javiercn on Wednesday, August 30, 2023 10:24:32 AM

    @lonix1 thanks for contacting us.

    This is more likely a question for the dotnet/docker repository since they centrally manage all images.

    @richlander thoughts?

  3. ghost added
    area-dockerfilesConcerns the official .NET Dockerfiles or Dockerfile templates
    on Aug 30, 2023
  4. locked and limited conversation to collaborators on Aug 30, 2023
  5. converted this issue into a discussion #4852 on Aug 30, 2023
  6. moved this from Backlog to Done in .NET Dockeron Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dockerfilesConcerns the official .NET Dockerfiles or Dockerfile templatesuntriaged

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions