mathworks-ref-arch / matlab-dockerfile

Create a docker container that contains a MATLAB install
Other
339 stars 96 forks source link

How to use a network named license for toolboxes in a container #77

Closed NadineNijssenPhilips closed 1 year ago

NadineNijssenPhilips commented 1 year ago

Hi! I build a container with Matlab r2023a and Matlab Coder. I added the license server in the Dockerfile. I can run the container and use Matlab, but not the Matlab Coder. I get licensing error -39,147. image

On my desktop I have the license for the Matlab Coder (it is a network named license). How can I use this in the container?

NadineNijssenPhilips commented 1 year ago

Answer from MathWorks Support:

The default username for the container is "matlab". You will have to modify the Dockerfile and rebuild the container. In order to use your Network Named User license in the container, you should replace "matlab" with your usual Windows or Linux username in the six places that I indicated in bold below:

RUN adduser --shell /bin/bash --disabled-password --gecos "" matlab \ && echo "matlab ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/matlab \ && chmod 0440 /etc/sudoers.d/matlab

USER matlab WORKDIR /home/matlab

After re-building the container with the recommended modifications, you should be able to use your Network Named User license in the container without error.

This didn't work for me because my username is a number. But a good answer to the question.

Suggestions are to change username to start with a non-numeric character. Or to use a different type of license.

prabhakk-mw commented 1 year ago

Hi @NadineNijssenPhilips

My apologies for not reaching out sooner, do you need any more assistance with this issue?

However, if this is no longer an issue, could you please share how you overcame it?