Matlab, Windows compatible Docker Container Fails to run Matlab job steps of Azure Devops CI/CD job

I’m trying to make a Matlab/Windows/FMU Compatible docker container to run my works AzureDevops CI/CD Pipeline. But I’m having issues when I run a CI build job online.
When it tries to run any matlab code, I get his error:


2020-12-10T14:55:08.0295754Z ##[debug]   cd('C:azpagent_work_temp'); command_3a2582de_1b59_40fc_8400_bb6ddbb6b019
2020-12-10T14:55:08.0312327Z [command]C:Windowssystem32cmd.exe /D /S /C "C:azpagent_work_tasksRunMATLABCommand_28fdff80-51b4-4b6e-83e1-cfcf3f3b25a6{$content}.3.7binrun_matlab_command.bat "cd('C:azpagent_work_temp'); command_3a2582de_1b59_40fc_8400_bb6ddbb6b019""
2020-12-10T14:55:08.8200355Z Fatal Internal Error: std::exception: Bundle#4 start failed: Loading C:Program FilesMATLABR2017bbinwin64matlab_startup_pluginslmgrimpllibmwlmgrimpl.dllfailed with error: The specified module could not be found.

I have no problem running my CI/CD loop using my own computer as a self-hosted agent, but I’m having problem running matlab inside my container.

I have tried doing this:
by adding directly the dlls, to my src project, pushing the code(with the dlls) to azure and forcing dlls to be loaded to my docker container. Didn’t work. A bit more info, I don’t have any executables. I have a build process generated from a matlab control project and I also have a testing process running simulink files inside of a matlab unit test class.


# Indicates that the windowsservercore image will be used as the base image.

# Metadata indicating an image maintainer.
LABEL maintainer="***@***.com"

# Define Work Directory
RUN mkdir C:install

# Installing Packet Manager
RUN powershell -command Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(''))
RUN powershell -command Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser; Invoke-Expression (New-Object System.Net.WebClient).DownloadString('')
# Installing Depedencies
RUN mkdir c:toolscygwin && cd c:toolscygwin && curl -Sso cygwinsetup.exe && start /wait cygwinsetup -q --root C:toolscygwin -P dos2unix,make,perl,python27,python38,rsync,libxml2,pbzip2,mc -X --site
RUN setx PATH "%PATH%;C:toolscygwinbin" /M
RUN powershell -command choco install -y git
RUN powershell -command choco install -y mingw 
RUN powershell -command choco install -y cmake 
RUN powershell -command choco install -y wget 
RUN powershell -command choco install -y ninja 
RUN powershell -command choco install -y python3 

# Verification Step
RUN choco -?
RUN path
RUN ls
RUN wget --help

# Fetch

#RUN wget -rH
RUN curl -o
RUN python
# Transfert Self-Hosted Agent Script
COPY start.ps1 .
# Transfert Matlab Install & Licences
COPY _temp_matlab_R2017b_win64 C:install_temp_matlab_R2017b_win64
COPY MathWorks C:UsersContainerAdministratorDownloadsMathWorks
COPY network.lic C:install
COPY matlab_license.dat C:install
COPY installer_input.txt C:install
# Transfert Modelon Install & Licences
COPY FMI_Toolbox-2.8-win.exe C:install
COPY fmi_license.lic C:install
RUN ls ..install
#Install Matlab
#RUN powershell.exe -command 
#     Start-Job -ScriptBlock {C:install_temp_matlab_R2017b_win64setup.exe -inputFile C:installinstaller_input.txt} -Name matlabInstallContainer ;
#     Wait-Job -Name "matlabInstallContainer";
#     Stop-Job -Name "matlabInstallContainer";
RUN powershell.exe -command 
  "&C:install_temp_matlab_R2017b_win64setup.exe -inputFile C:installinstaller_input.txt | Out-Null"
#Install Modelon
RUN C:installFMI_Toolbox-2.8-win.exe /S /D=C:Program Files (x86)ModelonFMI Toolbox 2.8
#RUN matlab -r "cd 'C:Program Files (x86)ModelonFMI Toolbox 2.8';setup('C:installfmi_license.lic', true);exit;"
RUN mkdir C:WindowsServiceProfilesNetworkServiceAppDataRoamingModelonLicensesServer
RUN cp C:installfmi_license.lic C:WindowsServiceProfilesNetworkServiceAppDataRoamingModelonLicensesServer

# Sets a command or process that will run each time a container is run from the new image.
CMD powershell .start.ps1
#CMD [ "cmd" ]

Source: Docker Questions