Main Content

MATLAB Container on Docker Hub

Access MATLAB® on the cloud or in server environments by using the MATLAB container available on Docker Hub. The MATLAB container provides a simple and flexible solution to run MATLAB in cloud environments such as AWS® or Microsoft® Azure®. For more information on containers, see What is a Container?.

Contents

The MATLAB container includes:

  • An Ubuntu® base image

  • MATLAB (no additional toolboxes)

  • Dependencies to run all MathWorks® products

  • Software to enable interaction with the MATLAB desktop

Requirements

To use the MATLAB container, you need:

  • A host machine with Docker® installed.

  • A MATLAB license that is:

    • Valid for all the MathWorks products installed in the container.

    • Linked to a MathWorks Account.

    • Configured for cloud use. Individual and Campus-Wide licenses are already configured. For other license types, contact your license administrator. You can identify your license type and administrator by viewing your MathWorks Account. Administrators can consult Administer Network Licenses.

  • If you have a Concurrent license , you must supply the port number and DNS address of the network license manager when you run the container. Add this option to the docker run command when you start the container -e MLM_LICENSE_FILE=27000@MyLicenseServer.

Quick Start Guide for MATLAB Container

This section shows an example of how to run the MATLAB container and launch an interactive MATLAB session in a web browser. For a complete list of commands to start the MATLAB container, including how to interact with MATLAB through a VNC client and how to use MATLAB in batch mode, see MATLAB Container Image on Docker Hub.

Pull Container

To download the MATLAB container image onto the host machine, run this command on the command line:

docker pull mathworks/matlab:r20XYz

You must replace the tag r20XYz with the specific MATLAB release name, for example, r2022a. Downloading and extracting the container image can take some time.

Run Container

Run the MATLAB container using this command:

docker run -it --rm -p 8888:8888 --shm-size=512M mathworks/matlab:r20XYz -browser

  • -it runs the container in interactive mode.

  • --rm deletes the container when finished.

  • -p 8888:8888 exposes port 8888 for the web browser connection.

  • --shm-size=512M sets the size of the shared memory to 512 MB, which is required for MATLAB to run correctly.

  • :r20XYz chooses release version R20XYz of the MATLAB container.

  • -browser chooses the option for interacting with MATLAB via a web browser.

Running the command above causes a URL to be printed to your terminal. To access MATLAB, enter the URL into a web browser. If prompted to do so, enter credentials for a MathWorks account associated with a MATLAB license.

Note

  • The -browser option is supported by docker images from release version R2022a on. To access MATLAB in a web browser in custom docker images or older MATLAB docker images, see Examples.

  • The -browser option is not supported by some browsers. For more information, see Cloud Solutions Browser Requirements.

For a full list of options and environment variables that you can use to start the container, run the container with the -help flag:

docker run -it --rm mathworks/matlab:r20XYz -help

For more information about configuring a MathWorks container using environment variables, see Configure Containers.

Related Topics

External Websites