MATLAB Runtime Containers
MATLAB® Runtime is a standalone set of shared libraries that lets you run compiled MATLAB code outside of MATLAB. You can create compiled applications and components using MATLAB Compiler™ and MATLAB Compiler SDK™. To use a MATLAB Runtime container, you need a host machine with Docker® installed.
The MathWorks® container registry provides MATLAB Runtime container images for use in your development environment. MATLAB Runtime Docker images are based on Ubuntu® Linux®. You can use containers in CI/CD pipelines to run MATLAB code in a Docker environment.
You can deploy a MATLAB Runtime container to Docker directly, or you can use the container image as a layer in a standalone Docker
image using compiler.package.docker or a microservice image using compiler.package.microserviceDockerImage (MATLAB Compiler SDK). Starting in R2023b, you can create
a custom MATLAB Runtime container image that can run multiple applications using compiler.runtime.createDockerImage. This option
allows you to create a MATLAB Runtime
Docker image with a custom base layer image.
Starting in R2024b, there are two prebuilt images available: A full MATLAB Runtime image with GPU support and an image without GPU libraries.
MATLAB Runtime Container Contents
A MATLAB Runtime container image includes:
Ubuntu Linux base image.
MATLAB Runtime.
Dependencies to run MathWorks products. Packages are sourced from
https://github.com/mathworks-ref-arch/container-images/tree/main/matlab-runtime-deps.
Agree to License and Set Library Path
To use a MATLAB Runtime container directly, you must agree to the MATLAB Runtime license by setting the container environment variable
AGREE_TO_MATLAB_RUNTIME_LICENSE to "yes". You
can do this by setting the environment variable in the Dockerfile or in the
docker run command when deploying the container.
For instance, agree to the license in the docker run command for a
MATLAB Runtime R2026a
container.
docker run --rm -e "DISPLAY=:0" -v /tmp/.X11-unix:/tmp/.X11-unix \
-e "AGREE_TO_MATLAB_RUNTIME_LICENSE=yes" \
containers.mathworks.com/matlab-runtime:r2026aPrior to R2026a, you must set the library path environment variable
LD_LIBRARY_PATH in the MATLAB Runtime container to point to the runtime libraries.
For instance, to agree to the license and set the library path for MATLAB Runtime R2025b, add the following lines to the Dockerfile before deployment.
ENV AGREE_TO_MATLAB_RUNTIME_LICENSE="yes"
ENV LD_LIBRARY_PATH="/opt/matlabruntime/R2025b/runtime/glnxa64:\
/opt/matlabruntime/R2025b/bin/glnxa64:\
/opt/matlabruntime/R2025b/sys/os/glnxa64:\
/opt/matlabruntime/R2025b/sys/opengl/lib/glnxa64:\
/opt/matlabruntime/R2025b/extern/bin/glnxa64"Download Full MATLAB Runtime Image
Starting in R2024b, download a full MATLAB Runtime container image that contains GPU libraries by executing the following command at a system terminal:
docker pull containers.mathworks.com/matlab-runtime:<releaseName>-fullThe term releaseName refers to the specific version of the
MATLAB release. It is denoted with a lowercase r followed by
the year and edition of the release. For instance, if you want a MATLAB Runtime container for the second edition of the 2023 release, you would specify
<releaseName> as r2023b.
The URL has the suffix -full to distinguish it from the image
without GPU support.
In releases prior to R2024b, the only image available is the full MATLAB Runtime container image that contains GPU libraries. To download the full MATLAB Runtime container image, execute the following command at a system terminal:
docker pull containers.mathworks.com/matlab-runtime:<releaseName>Download MATLAB Runtime Without GPU Libraries
Since R2024b
Starting in R2024b, the container registry offers a smaller MATLAB Runtime container image without GPU libraries in addition to the full MATLAB Runtime container image with GPU libraries. To download a MATLAB Runtime container image that does not include any GPU libraries, execute the following command at a system terminal:
docker pull containers.mathworks.com/matlab-runtime:<releaseName>releaseName refers to the specific version of the
MATLAB release. It is denoted with a lowercase r followed by
the year and edition of the release.For example, to download a MATLAB Runtime container image for R2025a without GPU libraries, execute the following command at a system terminal:
docker pull containers.mathworks.com/matlab-runtime:r2025aCreate Custom MATLAB Runtime Docker Image
Since R2023b
You can use the compiler.runtime.createDockerImage function
to create a custom MATLAB Runtime
Docker image. This allows you to customize the image; for instance, to use a
different base layer.
compiler.runtime.createDockerImage(buildResults, ... "BaseImage","my-baselayer", ... "ImageName","my-custom-matlabruntime:r2024b")
For an example on creating a standalone application Docker image using a custom base layer, see Create Docker Image Using Custom Base Layer.
For an example on creating a microservice using a custom base layer, see Create Microservice Using Custom Base Layer (MATLAB Compiler SDK).
Note
If you are unable to reach the Docker repositories, then you must first run compiler.runtime.createInstallerDockerImage with the path to the
Linux
MATLAB Runtime installer.
See Also
compiler.runtime.createDockerImage | compiler.runtime.createInstallerDockerImage | compiler.package.docker | compiler.package.microserviceDockerImage (MATLAB Compiler SDK)