【发布时间】:2020-12-14 14:53:13
【问题描述】:
我正在尝试创建一个 Docker 容器,我可以在其中使用 dotnet 运行加载 MATLAB 运行时 (MCR) DLL 以处理一些数据的 C# 程序。 (.net 核心 3.1,MATLAB 2014b)
我已经根据我在网上找到的example 安装了 MATLAB 的 MCR 运行时为 Ubuntu 的官方 dotnet 映像创建了一个映像。这是我的Dockerfile:
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-focal
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq update && apt-get -qq install -y \
unzip \
xorg \
wget \
curl && \
mkdir /mcr-install && \
mkdir /opt/mcr && \
cd /mcr-install && \
wget http://ssd.mathworks.com/supportfiles/downloads/R2014b/deployment_files/R2014b/installers/glnxa64/MCR_R2014b_glnxa64_installer.zip && \
unzip -q MCR_R2014b_glnxa64_installer.zip && \
./install -destinationFolder /opt/mcr -agreeToLicense yes -mode silent && \
cd / && \
rm -rf mcr-install
ENV LD_LIBRARY_PATH /opt/mcr/v84/runtime/glnxa64:/opt/mcr/v84/bin/glnxa64:/opt/mcr/v84/sys/os/glnxa64:/opt/mcr/v84/extern/bin/glnxa64
当我以交互方式运行容器并尝试在其中运行 dotnet 时,我收到此错误:
❯ docker run -it dotnet-mcr:0.2 /bin/bash
root@1e15419d3fee:/# dotnet --info
Failed to load ���, error: /opt/mcr/v84/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by /usr/share/dotnet/host/fxr/3.1.10/libhostfxr.so)
The library libhostfxr.so was found, but loading it from /usr/share/dotnet/host/fxr/3.1.10/libhostfxr.so failed
- Installing .NET Core prerequisites might help resolve this problem.
https://go.microsoft.com/fwlink/?linkid=2063370
似乎我的Dockerfile 中的最后一行——设置LD_LIBRARY_PATH 的那一行——对于MCR 运行时至关重要,但会破坏dotnet 可执行文件。
我该如何解决这个问题?
注意:正如@jdweng 在下面评论的那样,升级到更新版本的 MATLAB 可能会通过调整冲突 DLL 的版本来解决问题。如果可能的话,我希望提供不涉及升级的解决方案。
【问题讨论】:
-
你编译dll的matlab版本必须和安装的matlab运行时版本一致。 docker 安装必须是安装和不同的运行时版本。
标签: c# matlab docker .net-core matlab-compiler