MATLAB Container on Docker Hub
Access MATLAB® in the cloud or in server environments by using the prebuilt MATLAB container available on Docker Hub. Use the MATLAB container to run MATLAB in cloud environments such as AWS® or Microsoft® Azure®. If you instead want to create and customize a MATLAB container image from a Dockerfile, see Create a Custom MATLAB Container. For more information about containers, see What is a Container?.
The MATLAB container includes:
An Ubuntu® base image
MATLAB (without additional toolboxes)
Dependencies to run all MathWorks® products
Software to enable interaction with the MATLAB desktop
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. To identify your license type and administrator, log in to your MathWorks Account. If you are an administrator, see 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 runcommand when you start the container:
Quick Start Guide for MATLAB Container
This section shows how to run the MATLAB container and launch an interactive MATLAB session either in browser mode or using a VNC client. For a complete list of commands to start the MATLAB container, including how to use MATLAB in batch mode, see MATLAB Container Image on Docker Hub.
To download the MATLAB container image onto the host machine, run this command in the
command line. You must replace the tag
r20XYz with the
specific MATLAB release name, for example,
and extracting the container image can take some
docker pull mathworks/matlab:r20XYz
Run Container in Browser Mode
Run the MATLAB container using this command:
docker run -it --rm -p 8888:8888 --shm-size=512M mathworks/matlab:r20XYz -browser
-itruns the container in interactive mode.
--rmdeletes the container when it is closed.
-p 8888:8888exposes port 8888 for the web browser connection.
--shm-size=512Msets the size of the shared memory to 512 MB, which is required for MATLAB to run correctly.
:r20XYzspecifies release version R20XYz of the MATLAB container.
-browserspecifies the option yo interacting with MATLAB through a web browser.
Running the command prints a URL 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.
Docker images support the
-browseroption from release version R2022a on. To access MATLAB in a web browser in custom docker images or older MATLAB docker images, see Examples.
Run Container in VNC Mode
You can also run the MATLAB container in VNC mode. Doing so allows you to install toolboxes or update MATLAB. For more details, see Install Updates, Toolboxes, Support Packages, and Add-Ons in Containers.
Run the MATLAB container in VNC mode by entering this command:
docker run --init -it --rm -p 5901:5901 -p 6080:6080 --shm-size=512M mathworks/matlab:r20XYz -vnc
-p 5901:5901exposes port 5901 for the VNC connection.
-p 6080:6080exposes port 6080 for the web browser connection.
-vncspecifies the option to interact with MATLAB through a VNC client.
To connect to the desktop where you can open MATLAB:
Use a VNC client to connect to display 1 of the Docker host machine (
If you do not have a VNC client, point a browser to port 6080 of the Docker host machine running this container (
If your container is not running on your local machine, replace
localhost with the fully qualified domain name (FQDN) of
the computer on which the container is running.
The default VNC password is
For a full list of options and environment variables that you can use to
start the container, run the container with the
docker run -it --rm mathworks/matlab:r20XYz -help
For more information about configuring a MathWorks container using environment variables, see Configure Containers.
- What is a Container?
- MATLAB Deep Learning Container on NVIDIA GPU Cloud for Amazon Web Services
- Administer Network Licenses
- Create a Custom MATLAB Container
- Install Updates, Toolboxes, Support Packages, and Add-Ons in Containers