Grpc-dotnet: Deploy .NET Core with Grpc on Docker get Error.

Created on 9 Aug 2020  路  3Comments  路  Source: grpc/grpc-dotnet

I'm build a web API app using .NET core and gRPC for Csharp.

In Local, It work verry well, but when I build container and run it on Docker Desktop, receive:

docker logs --tail=100 f30a5c0d755e
warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
      Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {508718d1-f261-4b39-bb67-e3ca9825fc76} may be persisted to storage in unencrypted form.
Unhandled exception. System.IO.IOException: Error loading native library "/app/runtimes/linux/native/libgrpc_csharp_ext.x64.so". Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /app/runtimes/linux/native/libgrpc_csharp_ext.x64.so)
   at Net.Core.Grpc.GrpcServerManagerment.InvokeException(Exception exception, Action`1 whenException)
   at Net.Core.Grpc.GrpcServerManagerment.InitServer(IEnumerable`1 services, IServerTracer tracer, List`1 interceptors, List`1 channelOptions, Action`1 whenException, Action`1 grpcConfigAction)
   at Net.Core.Grpc.GrpcServerManagerment.InitServer(ServerServiceDefinition service, IServerTracer tracer, List`1 interceptors, List`1 channelOptions, Action`1 whenException, Action`1 grpcConfigAction)
   at iNRES.Service.Category.gRPC.Server.GrpcServer.<StartAsync>b__2_0() in /app/src/iNRES.Service.Category/gRPC/Server/gRPCServers.cs:line 32
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.HostedServiceExecutor.ExecuteAsync(Func`2 callback, Boolean throwOnFirstFailure)
   at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at iNRES.Service.Category.Program.Main(String[] args) in /app/src/iNRES.Service.Category/Program.cs:line 20
warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
      Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
Unhandled exception. System.IO.IOException: Error loading native library "/app/runtimes/linux/native/libgrpc_csharp_ext.x64.so". Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /app/runtimes/linux/native/libgrpc_csharp_ext.x64.so)
   at Net.Core.Grpc.GrpcServerManagerment.InvokeException(Exception exception, Action`1 whenException)
   at Net.Core.Grpc.GrpcServerManagerment.InitServer(IEnumerable`1 services, IServerTracer tracer, List`1 interceptors, List`1 channelOptions, Action`1 whenException, Action`1 grpcConfigAction)
   at Net.Core.Grpc.GrpcServerManagerment.InitServer(ServerServiceDefinition service, IServerTracer tracer, List`1 interceptors, List`1 channelOptions, Action`1 whenException, Action`1 grpcConfigAction)
   at iNRES.Service.Category.gRPC.Server.GrpcServer.<StartAsync>b__2_0() in /app/src/iNRES.Service.Category/gRPC/Server/gRPCServers.cs:line 32
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.HostedServiceExecutor.ExecuteAsync(Func`2 callback, Boolean throwOnFirstFailure)
   at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at iNRES.Service.Category.Program.Main(String[] args) in /app/src/iNRES.Service.Category/Program.cs:line 20
question

Most helpful comment

Yep, please open an issue on https://github.com/grpc/grpc

All 3 comments

@vuggg What packages are you using? It looks like you're using grpc core (and the issue should be moved to https://github.com/grpc/grpc). What packages are in your project?

@vuggg What packages are you using? It looks like you're using grpc core (and the issue should be moved to https://github.com/grpc/grpc). What packages are in your project?

I using:

<PackageReference Include="Google.Protobuf" Version="3.8.0" />
        <PackageReference Include="Google.Protobuf.Tools" Version="3.8.0" />
        <PackageReference Include="Grpc.Tools" Version="1.22.0" />
<PackageReference Include="Grpc" Version="2.31.0" />

Yep, please open an issue on https://github.com/grpc/grpc

Was this page helpful?
0 / 5 - 0 ratings