在 dotnet/core/runtime-deps:2.2-alpine3.9 上使用 grpc 得到符号未找到错误

Vin*_*Lai 5 c# docker .net-core grpc

我在我的 .netcore 程序中使用了 grpc,我想构建一个 docker 镜像来使用它。

这就是我在 dockerfile 中构建程序的方式

RUN  dotnet publish -r linux-musl-x64 --no-restore -c Release -o /out
Run Code Online (Sandbox Code Playgroud)

我复制到其他图像,就像我的图像一样

RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY --from=build /out ./
ENTRYPOINT ["./MyService"]
Run Code Online (Sandbox Code Playgroud)

问题是关于运行时映像。如果我使用“microsoft/dotnet:2.2-runtime-deps-alpine”没有问题,但如果使用“mcr.microsoft.com/dotnet/core/runtime-deps:2.2-alpine3.9”

我收到一条错误消息。

Unhandled Exception: System.IO.IOException: Error loading native library "/app/libgrpc_csharp_ext.x64.so". Symbol not found: PAL_dlerror
at Grpc.Core.Internal.UnmanagedLibrary..ctor(String[] libraryPathAlternatives)
at Grpc.Core.Internal.NativeExtension.LoadUnmanagedLibrary()
at Grpc.Core.Internal.NativeExtension.LoadNativeMethods()
at Grpc.Core.Internal.NativeExtension..ctor()
at Grpc.Core.Internal.NativeExtension.Get()
at Grpc.Core.GrpcEnvironment.GrpcNativeInit()
at Grpc.Core.GrpcEnvironment..ctor()
at Grpc.Core.GrpcEnvironment.AddRef()
at Grpc.Core.Server..ctor(IEnumerable`1 options)
at MyService.Program.Main(String[] args) in /code/MyService/Program.cs:line 32
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?这两张图有什么区别?我只能找到第二one`s Dockerfile上泊坞窗枢纽