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?.
The MATLAB container includes:
Ubuntu® base image
MATLAB (no 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 for the container with Docker installed.
A MATLAB license valid for the MathWorks products installed in the container. You must configure your MATLAB license for cloud use. For more information, see Configure License for MathWorks Containers (Licensing on Cloud Platforms).
This section shows an example of how to run the MATLAB container and access the MATLAB desktop from a web browser. 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 code:
docker pull mathworks/matlab:r20XYz
You must replace the tag
r20XYz with the specific
MATLAB release name, for example,
r2020b. Note that
downloading and extracting the container image can take some time.
Run the MATLAB container using this command:
docker run -it --rm -p 5901:5901 -p 6080:6080 --shm-size=512M mathworks/matlab:r20XYz -vnc
-it runs the container in interactive
--rm deletes the container when
-p 5901:5901 and
6080:6080 expose port 5901 for the VNC connection and
port 6080 for the web browser connection.
--shm-size=512M sets the size of shared memory
to 512 MB, which is required for MATLAB desktop to run
:r20XYz chooses the release version of the
-vnc starts the VNC server process for
To access the MATLAB desktop via a web browser, use the URL
is the name of the machine hosting the container. To access the container, use
the default password
matlab. Alternatively, you can use the
same password to access the container via a VNC client. If you are using a cloud
service provider or if your host or client machines are protected by a firewall,
you must set up SSH tunnels between your client machine and the Docker® host to access the container desktop.
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
When you want to run an application or a piece of software in a reliable way in multiple different locations, you can use a container. A container is a minimal package that contains everything required to run a specific application (or set of applications), including code, libraries, drivers, and settings. Because applications in a container always run in the same way, they are useful for managing well-defined test and deployment environments.
Unlike a virtual machine, containers share the operating system of the host machine and multiple instances of the same container share common resources. This feature makes them lightweight. However, containers are isolated from each other and the host operating system. That is, applications inside a container can only access files and processes provided within that container.
You can deploy multiple instances of the same container on the same or different hosts to test your applications simultaneously. To extend functionality, you can mount additional files, folders, and devices into containers.