MATLAB docker container login via script?

조회 수: 7 (최근 30일)
Shyamal Agarwal
Shyamal Agarwal 2022년 4월 28일
답변: Dheeraj 2024년 6월 26일
Hi Team,
Using MATLAB docker image, https://hub.docker.com/r/mathworks/matlab ->
  1. We want to learn how to pass user name and password for MATLAB via bash script.
  2. Once the container job rub is completed, we want to end the MATLAB session. We are facing below session error when re-running the container probably as the session has not ended in previous run.
ERROR:
License Manager Error -4
Maximum number of users for MATLAB reached. Try again later
  댓글 수: 3
Shyamal Agarwal
Shyamal Agarwal 2022년 5월 20일
Hi Yu,
Thanks for your response. We are currently building on top of MATLAB container with additional tools and libraries layers. We would be invoking matlab command directly via bash script in the docker container.
root@54f54c3d694c:/data# matlab
MATLAB is selecting SOFTWARE OPENGL rendering.
Please enter your MathWorks Account email address and press Enter:
sagarwal12@bwh.harvard.edu
Please enter your MathWorks Account password and press Enter:
Starting MATLAB with license:
Instead we want to pass credentials while invoking MATLAB, for ex:
matlab --credentials=credentials.txt
or
matlab --username=xxxx --password=xxxx
Situation 2, matlab session is not disconnected when we exit from MATLAB program, ex:
>> exit
root@54f54c3d694c:/data# matlab
MATLAB is selecting SOFTWARE OPENGL rendering.
Starting MATLAB with license: 10314731 - MathWorks Trial - 27 May 2022
So what happens is, once we kill the container and re-run a new container, since old session was never ended, we are not able to logon with the following error:
ERROR:
License Manager Error -4
Maximum number of users for MATLAB reached. Try again later
Mauro
Mauro 2024년 6월 25일
Hey, same problem here. Did you find a solution?

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

답변 (1개)

Dheeraj
Dheeraj 2024년 6월 26일
Hi Shyamal Agarwal,
I understand you want to launch MATLAB docker container non-interactively.
By default MATLAB container is configured to use Online Licensing so if you have an individual license or your organization is setup to use Online Licensing it prompts to enter your MathWorks Account username and password.
Online Licensing isn't always an option and in some cases isn't a desired workflow. Instead you can use run the container using license server instead.
You can specify the license server you want the container to acquire licenses from by passing an environment variable with the "-e" option when you launch a container. This will set up an environment variable within the container. MATLAB conveniently looks for MLM_LICENSE_FILE when starting and will use it for license authentication.
docker run -it --rm -e MLM_LICENSE_FILE=27000@<IP of your License server> mathworks/matlab
To know more about how to use MATLAB docker image and its reference architecture along with the configurations available, you could go refer to the below URL.
To know more about how to create custom MATLAB docker container you could refer to the below MATLAB's documentation.

카테고리

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