To run MathWorks® products in your container, including MathWorks containers, you must also implement online or network licensing to use these products.
MathWorks licensing and products are supported only on Docker containers (MathWorks containers are Docker containers).
For individual licenses, you must have a graphical user interface (GUI) available in your container. This is because individual licenses use Login Named User licensing when running in a container, and Login Named User authentication only works in a desktop environment.
For more information, see What is Login Named User and how can I use it?
If you are using a container built by MathWorks and obtained from NGC or Docker Hub, command-line LNU authentication is available. Refer to Network License Manager (MathWorks Cloud Center) in the Cloud Center documentation for more information.
You cannot use a license file with containers. With an individual license, containers must use MathWorks online licensing only.
To use a network license (Network Named Users or Concurrent) in your container, you must be running a network license manager on a license server. The license manager can be in a container, on a virtual machine, or on a physical machine.
To install the license manager in a container, see Create a MATLAB Container Image.
|Virtual Machine||To install the license manager on a separate virtual machine, see Configure License Manager on Separate Virtual Machine.|
|Physical Machine||To install the license manager on a physical machine, set environment variables "LM_LICENSE_FILE" and "MLM_LICENSE_FILE.” For details, see method 2 in the MATLAB® Answer How can I change the license server used by MATLAB clients?|
If you are an administrator on a Network Named User License, you must define the users who can access the license. See Define Users on a Network Named License.
If you are an administrator on a Concurrent License, users are not named but instead check out keys to access the license. See Concurrent License Keys.
Define Users on a Network Named License. The default user is root, but in order to ensure accurate counting of seats, you must run each container with a specific user name. Users cannot be added to containers after the container is built, so be sure to build any user name you will potentially need to use into the Dockerfile before you build the container.
To define users for the container, add users in the Dockerfile and then run the container as a specified user. The following Dockerfile command adds the specified user to the container:
RUN useradd -ms /bin/bash <USERNAME>
This next Dockerfile command sets the container to run as the specified user:
-u runtime flag overrides any
that was built into the container. You can use this to change the user of the container
at runtime. For more information, see the Docker
Concurrent License Keys. A Concurrent license enables you to make MathWorks products available to anyone with access to your network. Access is not limited to specific named users, as it is with a Network Named User license. Rather, Concurrent licenses use license keys to control access. Users check out a license key when they start MATLAB or use functions in other products. When all the keys for a particular product are checked out, the network license manager denies further requests.
There is one important concept about implementing a concurrent license in a container: unlike running multiple instances of MATLAB on bare metal on the same host, each container appears as a distinct host. There are some rare exceptions, but in general, you can expect this to be the case.