Main Content

MATLAB Deep Learning Container on Docker Hub

Speed up your deep learning applications by training neural networks in the MATLAB® Deep Learning Container available on Docker Hub, designed to take full advantage of high-performance NVIDIA® GPUs. The MATLAB Deep Learning Container provides a simple and flexible solution to use MATLAB for deep learning workflows in cloud environments such as AWS® or Microsoft® Azure®. For more information on containers, see What is a Container?.


The MATLAB Deep Learning Container includes:

  • Ubuntu® base image

  • MATLAB and the following toolboxes:

    • Computer Vision Toolbox™

    • Deep Learning Toolbox™

    • GPU Coder™

    • Image Processing Toolbox™

    • MATLAB Coder™

    • Parallel Computing Toolbox™

    • Signal Processing Toolbox™

    • Statistics and Machine Learning Toolbox™

    • Text Analytics Toolbox™

  • Several Pretrained Deep Neural Networks (Deep Learning Toolbox)

  • Support packages useful for deep learning workflows

  • Dependencies to run all MathWorks® products

  • GPU drivers necessary to use NVIDIA GPUs in the container

  • Software to enable interaction with the MATLAB desktop

In addition, you can import networks and network architectures into the container from TensorFlow™-Keras and Caffe, with or without layer weights. You can also convert trained networks to the Open Neural Network Exchange (ONNX) model format.


To use the MATLAB Deep Learning Container, you need:

  • A host machine with Docker® 19.03 or newer installed.

  • A MATLAB license that meets the following conditions:

  • If you have a Concurrent license type, you must supply the port number and DNS address of the network license manager when you run the container. Add an option of the following form to the docker run command when you start the container:

    -e MLM_LICENSE_FILE=27000@MyLicenseServer

Quick Start Guide for MATLAB Deep Learning Container

This section shows an example of how to run the MATLAB Deep Learning Container and access the MATLAB desktop from a web browser. For a complete list of commands to start the MATLAB Deep Learning Container, including how to use MATLAB in batch mode, see MATLAB Deep Learning Container Image on Docker Hub.

Pull Container

To download the MATLAB Deep Learning Container image onto the host machine, run this code:

docker pull mathworks/matlab-deep-learning:r20XYz 

You must replace the tag r20XYz with the specific MATLAB release name, for example, r2021b. Note that downloading and extracting the container image can take some time.

Run Container

Run the MATLAB Deep Learning Container using this command:

docker run --gpus all -it --rm -p 5901:5901 -p 6080:6080 --shm-size=512M mathworks/matlab-deep-learning:r20XYz -vnc

  • --gpus all makes the GPUs of the host visible to the container. For more information, see Use GPUs in Containers.

  • -it runs the container in interactive mode.

  • --rm deletes the container when finished.

  • -p 5901:5901 and -p 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 correctly.

  • :r20XYz chooses the release version of the MATLAB Deep Learning Container.

  • -vnc starts the VNC server process for MATLAB desktop.

To access the MATLAB desktop via a web browser, use the URL http://hostname:6080, where hostname 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 detailed instructions, see Create Encrypted Connection to Remote Applications and Containers.

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-deep-learning:r20XYz -help

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

Related Topics

External Websites