尝试在 docker 映像上安装 Matlab 运行时以及我正在处理的项目,该项目是一个引擎,它将根据给定的内容运行各种测量,其中许多测量都使用 Matlab。当我运行 docker 时,出现“MWArray 程序集初始化失败”或缺少 matlab dll 的错误。
由于公司要求,我尝试在 Windows 版 Docker 中运行此程序,但无法成功让 DockerFile 识别 MCR。下面是我一直在使用的将 MCR 放到 docker 上的代码。
FROM mcr.microsoft.com/dotnet/framework/runtime:4.7.2-windowsservercore-ltsc2019
ADD http://ssd.mathworks.com/supportfiles/downloads/R2017b/deployment_files/R2017b/installers/win64/MCR_R2017b_win64_installer.exe C:\\MCR_R2017b_win64_installer.zip
# Line 3: Use PowerShell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Line 4: Unpack ZIP contents to installation folder
RUN Expand-Archive C:\\MCR_R2017b_win64_installer.zip -DestinationPath C:\\MCR_INSTALLER
# Line 5: Run the setup command for a non-interactive installation of MCR
RUN Start-Process C:\MCR_INSTALLER\bin\win64\setup.exe -ArgumentList '-mode silent', '-agreeToLicense yes' -Wait
# Line 6: Remove ZIP and installation folder after setup is complete
RUN Remove-Item -Force -Recurse C:\\MCR_INSTALLER, C:\\MCR_R2017b_win64_installer.zip
WORKDIR /app
COPY /Project/bin/Debug/*.dll ./
COPY /Project/bin/Debug/Project.exe .
ENTRYPOINT ["C:\\app\\Project.exe"]
编辑:我想我已经找到了一个可行的解决方案,遵循其他 anwser 关于 ltsc2019 不适用于 Matlab 2017b 的想法。以下代码已在 docker 中与 2017b 一起使用。
FROM mcr.microsoft.com/windows:1809
MATLAB R2017b 不支持 Windows Server 2019,直到 MATLAB R2019a 才引入对其的支持。
对于 MATLAB R2017b,您需要 Windows Server 2016。
这并不是说可能不存在其他问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)