What are the parameters to run Matlab runtime container?

27 ビュー (過去 30 日間)
Pablo Cordova Montecinos
Pablo Cordova Montecinos 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 Cordova Montecinos
Pablo Cordova Montecinos 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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by