What are the parameters to run Matlab runtime container?

조회 수: 17 (최근 30일)
Pablo
Pablo 2024년 10월 24일
댓글: Hitesh 2024년 10월 25일
What are the parameters needed to run the MATLAB Runtime Docker container? I found the documentation on how to pull the image, but how do I use it to run a container? Could you provide guidance or examples on how to properly execute and utilize the MATLAB Runtime container?

채택된 답변

Hitesh
Hitesh 2024년 10월 24일
편집: Hitesh 2024년 10월 25일
Hi Pablo,
You need to use the following command to run the MATLAB Runtime Docker container which you have pulled from Docker Hub.
docker run --rm -it -v /path_to_your_app -w /app containers.mathworks.com/matlab-runtime ./your_executable
Refer to the below explanation for understanding of the parameters that are used in the command:
  • --rm: Automatically removes the container when it exits.
  • -it:Runs the container interactively.
  • -v /path_to_your_app:Mounts your local directory to the container. Replace"path_to_your_app"with the path to your application files.
  • -w /app:Sets the working directory inside the container to"/app".
  • containers.mathworks.com/matlab-runtime:Specify the MATLAB Runtime docker image that you have pulled it.
  • ./your_executable: The name of the executable.
There are some more parameters such as "--name", and "-e" but they are optional, their usage depends on what operation you want to perform on the docker image.
For more information on docker run command, refer to the below MATLAB documentation,
  댓글 수: 2
Pablo
Pablo 2024년 10월 24일
Thanks for the advice, but I’m still having some issues.
Context: I’m using Docker on a Windows machine and initially used MATLAB to run my files. Now, I want to create a standalone app that works without a MATLAB license, processing input files and dates, and generating output files. My goal is to deploy this app via an API for multiple users.
I read in the documentation that I can only build the Docker image for the app on a Linux machine. Is there any way to do this on Windows, or should I switch to Linux?
I tried creating an executable (example_main.exe) using:
res = compiler.build.standaloneApplication('example_main.m','TreatInputsAsNumeric',true)
Then I ran the app with the command:
docker run --rm -it -v "C:\Users\test\app:/app" -v "C:\Users\test\app\data_input:/app/input" -v "C:\Users\test\app\data_output:/app/output" -w /app containers.mathworks.com/matlab-runtime:r2024a ./example_main.exe '2024-10-23' '2024-10-30' '/app/input/data.csv' '/app/output'
However, I got this error:
<3>WSL (1) ERROR: UtilBindVsockAnyPort:286: socket failed 38
Is this error related to using Windows, or is it caused by something else?
Hitesh
Hitesh 2024년 10월 25일
Hi Pablo Cordova Montecinos,
According to the documentation, it is only supported for Linux, refer to the below MATLAB documentation:
For the creating standalone Application, refer to the below MATLAB documentation:
I am assuming that you would be using wsl for linux and so check your ".wslconfig" file located in your Windows user directory for misconfigurations. The error is potentially pops out because of the misconfigurations.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Containers에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by