Unable to run in aspnet:8.0-alpine
feffe81 opened this issue · 3 comments
When running as docker container I get
Unhandled exception. System.TypeInitializationException: The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception.
2024-03-22T11:16:16.853868543+01:00 ---> System.DllNotFoundException: Unable to load shared library 'onnxruntime' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
2024-03-22T11:16:16.853882633+01:00 Error loading shared library /app/runtimes/linux-x64/native/onnxruntime.so: No such file or directory
2024-03-22T11:16:16.853892674+01:00 Error loading shared library /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.3/onnxruntime.so: No such file or directory
2024-03-22T11:16:16.853902558+01:00 Error loading shared library /app/onnxruntime.so: No such file or directory
Any hint or example project available? Many thanks.
Looks like this might be the steps you need: https://stackoverflow.com/questions/67457600/adding-onnxruntime-library-to-a-net-core-docker-container-for-linux
I'll close since this seems like the answer, but if not please let us know!
No wait, that's not quite it.
It looks like ONNX runtime doesn't currently have prebuilt binaries for Alpine (microsoft/onnxruntime#2909), so you'd have to either:
- Use a different Linux base image rather than Alpine
- Or, build the ONNX runtime for Alpine yourself
This is out of scope for what we'd solve inside this repo. To move forwards most easily, I'd definitely recommend using a base image that ONNX does support natively, e.g., mcr.microsoft.com/dotnet/aspnet:8.0
.
Ok. Thanks. I am using the image you mentioned now.