A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mathworks-ref-arch/matlab-dockerfile below:

mathworks-ref-arch/matlab-dockerfile: Create a docker container that contains a MATLAB install

Create MATLAB Container Image

This repository shows you how to build and customize a Docker® container for MATLAB® and its toolboxes, using the MATLAB Package Manager (mpm). You can use this container image as a scalable and reproducible method to deploy and test your MATLAB code.

Use the Dockerfile in this top-level repository if you want a lightweight and simple way to create a MATLAB container image. You can also download prebuilt images based on the Dockerfile from here.

For alternative resources, see the alternates folder that contains the following Dockerfiles:

For more Docker related resources, see More MATLAB Docker Resources.

Access the Dockerfile either by directly downloading this repository from GitHub®, or by cloning this repository and then navigating to the appropriate folder.

git clone https://github.com/mathworks-ref-arch/matlab-dockerfile.git
cd matlab-dockerfile
Build and Run Docker Image

Build container with a name and tag of your choice.

docker build -t matlab:R2025a .

Run the container. Test the container by running an example MATLAB command, such as ver.

docker run --init --rm -e MLM_LICENSE_FILE=27000@MyServerName matlab:R2025a -batch ver

The Dockerfile defaults to building a container for MATLAB R2025a.

The example command ver displays the version number of MATLAB and other installed products. For more information, see ver. For more information on running the container, see the Run the Container section.

Note

Use the --init flag in the docker run command to ensure that the container stops gracefully when a docker stop or docker kill command is issued. For more information, see these links:

By default, the Dockerfile installs the latest available MATLAB release without any additional toolboxes or products in the /opt/matlab/${MATLAB_RELEASE} folder.

Use the options below to customize your build.

Customize MATLAB Release, MATLAB Product List, MATLAB Install Location, and License Server

The Dockerfile supports these Docker build-time variables:

Argument Name Default value Description MATLAB_RELEASE R2025a MATLAB release to install, for example, R2023b. MATLAB_PRODUCT_LIST MATLAB Space-separated list of products to install, for example, MATLAB Simulink Deep_Learning_Toolbox Fixed-Point_Designer. For more information, see MPM.md. MATLAB_INSTALL_LOCATION /opt/matlab/R2025a Path to install MATLAB. LICENSE_SERVER unset Port and hostname of the machine that is running the network license manager, using the port@hostname syntax. For example: 27000@MyServerName

Use these arguments with the the docker build command to customize your image. Alternatively, you can change the default values for these arguments directly in the Dockerfile.

Build an Image for a Different MATLAB Release

For example, to build an image for MATLAB R2019b, use this command.

docker build --build-arg MATLAB_RELEASE=R2019b -t matlab:R2019b .
Build an Image with a Specific Set of Products

For example, to build an image with MATLAB and Simulink®, use this command.

docker build --build-arg MATLAB_PRODUCT_LIST='MATLAB Simulink' -t matlab:R2025a .
Build an Image with MATLAB Installed to a Specific Location

For example, to build an image with MATLAB installed at /opt/matlab, use this command.

docker build --build-arg MATLAB_INSTALL_LOCATION='/opt/matlab' -t matlab:R2025a .
Build an Image Configured to Use a License Server

Including the license server information with the docker build command means you do not have to pass it when running the container.

# Build container with the license server.
docker build --build-arg LICENSE_SERVER=27000@MyServerName -t matlab:R2025a .

# Run the container without needing to pass license information.
docker run --init --rm matlab:R2025a -batch ver
Use the Network License Manager

This container requires a network license manager to license and run MATLAB. You need either the port and hostname of the network license manager or a network.lic file.

Step 1: Contact your system administrator, who can provide one of the following:

Step 2: Use port@hostname or the network.lic file with either the docker build or the docker run command.

With the docker build command, either:

With the docker run command, use the MLM_LICENSE_FILE environment variable.

docker run --init --rm -e MLM_LICENSE_FILE=27000@MyServerName matlab:R2025a -batch ver

If you did not provide the license server information when building the image, then provide it when running the container. Set the environment variable MLM_LICENSE_FILE using the -e flag, with the network license manager's location in the format port@hostname.

# Start MATLAB, print version information, and exit.
docker run --init --rm -e MLM_LICENSE_FILE=27000@MyServerName matlab:R2025a -batch ver

You can run the container without specifying MLM_LICENSE_FILE if you provided the license server information when building the image, as shown in the examples below.

Run MATLAB in an Interactive Command Prompt

To start the container and run MATLAB in an interactive command prompt, use this command.

docker run --init -it --rm matlab:R2025a

To start the container, run a MATLAB command, and then exit, use this command.

# Container runs the command RAND in MATLAB and exits.
docker run --init --rm matlab:R2025a -batch rand
Run MATLAB with Startup Options

To override the default behavior of the container and run MATLAB with any set of arguments, such as -logfile, use this command.

docker run --init -it --rm matlab:R2025a -logfile "logfilename.log"

To learn more, see the documentation: Commonly Used Startup Options.

More MATLAB Docker Resources Help Make MATLAB Even Better

You can help improve MATLAB by providing user experience information on how you use MathWorks products. Your participation ensures that you are represented and helps us design better products. To opt out of this service, delete this line in the Dockerfile.

ENV MW_DDUX_FORCE_ENABLE=true MW_CONTEXT_TAGS=MATLAB:DOCKERFILE:V1

To learn more, see the documentation: Help Make MATLAB Even Better - Frequently Asked Questions.

We encourage you to try this repository with your environment and provide feedback. If you encounter a technical issue or have an enhancement request, create an issue here.

Copyright 2021-2025 The MathWorks, Inc.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4