How can I install the "Simulink Real-Time Target Support Package" and "Speedgoat I/O Blockset" in a Docker container?

72 visualizaciones (últimos 30 días)
I am working on a CI pipeline using a headless version of MATLAB in a Docker® container. Building Simulink Real-Time models requires the "Simulink Real-Time Target Support Package" and "Speedgoat I/O Blockset" (mandatory since R2024a).
However, it seems that these support packages cannot be installed inside a Docker container. How can I get this CI pipeline up and running?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 27 de Oct. de 2025 a las 0:00
Editada: MathWorks Support Team hace alrededor de 7 horas
To build a custom MATLAB Docker container, we typically recommend using the MATLAB Package Manager (mpm). However, installing the "Simulink Real-Time Target Support Package" (SLRT SPKG) and "Speedgoat I/O Blockset" isn't currently supported via mpm for three reasons:
1. QNX Agreement: Accepting the QNX compiler agreement requires a GUI. Workaround: Download the SPKG files and read the agreement on your desktop, then copy the files into the container. Install them using the silent SPKG installer SupportSoftwareInstaller.sh which is included in MATLAB in R2024b and earlier.
2. SupportSoftwareInstaller.sh limitations: This script also needs a GUI (or Mesa libraries) in the container. Workaround: Install libglu1-mesa and libosmesa6 in the container before running SupportSoftwareInstaller.sh.
3. Post-Installation Routine: The SLRT SPKG requires executing a post-installation script in MATLAB. Workaround: Run MATLAB within the Docker build to run the SLRT SPKG slrealtime.internal.postInstallSetup routine as well as the Speedgoat I/O Blockset installer. Alternatively, do the same in the running Docker container.
⚠️ Important R2025a Update: The silent support package installer (SupportSoftwareInstaller.sh) was removed from MATLAB as part of the transition to New Desktop. You will need to interactively install both support packages.
Try This Workaround:
As a workaround, follow the three steps outlined below to include the necessary support packages in your custom MATLAB Docker Image. Refer to the two sample Dockerfiles attached above, which have been tested with R2024b and support different licensing methods:
  • matlab-withSLRT.dockerfile is based on the matlab-dockerfile main repository. Specify a Network License Server directly (License Option 1) or provide a network.lic license file (License Option 2). Both interactive (matlab) and non-interactive (matlab -batch) operations are supported.
  • matlab-batch-withSLRT.dockerfile is based on the alternates/non-interactive subdirectory. Utilize a batch licensing token for the matlab-batch tool, which is non-interactive only. For more information on MATLAB Batch Licensing and how to sign up, visit: MATLAB Batch Licensing - MATLAB & Simulink
NOTE: Simulink Real-Time (SLRT) supports Linux host computers beginning with MATLAB R2022a. Because MATLAB runs in Linux-based Docker containers, SLRT Docker workflows are not available in R2021b or earlier.
STEP 1: Download the support package files to a local machine
Perform the following either directly in your Docker build environment, or on any Windows or Linux machine from which you can transfer files to the Docker build environment:
1. Log in to the Speedgoat Customer Portal and download the "Speedgoat I/O Blockset" installer that matches your MATLAB release (e.g., "speedgoat_io_blockset_9_9_2_R2024b_build_39601.zip").
2. Download the MathWorks Support Software Downloader and obtain the SLRT SPKG files for your MATLAB release, as shown in the screenshots below:
3. Transfer the Speedgoat ZIP file (~400MB), the "SupportPackages" folder (~1.8-2.7GB), and an optional example model (slrt_ex_osc_rt.slx) to your Docker build environment:
STEP 2: Build the MATLAB Docker image
Ensure your Dockerfile contains the following points:
1. Include all required MATLAB toolboxes in your Docker container. For running SLRT builds, both "MATLAB Coder" and "Simulink Coder" are required in addition to "Simulink Real-Time":
ARG MATLAB_PRODUCT_LIST=\
"MATLAB \
Simulink \
MATLAB_Coder \
Simulink_Coder \
Simulink_Real-Time"
To identify all toolboxes needed for your model, run the license('inuse') command after building the model in your desktop MATLAB installation.
2. Include additional xvfblibglu1-mesa, and libosmesa6 packages to enable SupportSoftwareInstaller.sh to work.
3. Copy and install the SLRT SPKG in the Dockerfile:
  • Copy the contents of the 'SupportPackages/RXXXXx/' folder from STEP 1 into the working folder '/tmp/slrt'.
  • Use “SupportSoftwareInstaller.sh” to install the support package (sudo permissions required).
  • Copy over the installed support package from the "root" user folder to the “matlab” user folder.
# Install "Simulink Real-Time Target Support Package" (SLRT SPGK) using the Support Software Installer.
# 1. Download the package using the Support Software Downloader on your local system (https://www.mathworks.com/support/install/support-software-downloader.html).
# 2. Copy the SupportPackages folder contents into a temp folder.
# 3. Use xvfb-run and sudo permissions to run SupportSoftwareInstaller within the container to install the package.
# 4. COPY the support package folder from the root to the MATLAB user home directory, as the installer places it under root.
WORKDIR /tmp/slrt
COPY SupportPackages/${MATLAB_RELEASE} /tmp/slrt
RUN sudo HOME=${HOME} xvfb-run /opt/matlab/${MATLAB_RELEASE}/bin/glnxa64/SupportSoftwareInstaller -downloadfolder /tmp/slrt -inputFile /tmp/slrt/ssi_input.txt \
|| (echo "Support Package Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false) \
&& sudo rm -rf /tmp/mathworks_root.log /tmp/slrt
# COPY over the support package folder from root to matlab user home directory.
# The SupportSoftwareInstaller places the installed support package under root.
RUN mkdir -p /home/matlab/Documents/MATLAB/SupportPackages/ && \
sudo cp -a /root/Documents/MATLAB/SupportPackages/. /home/matlab/Documents/MATLAB/SupportPackages/ && \
sudo chown -R matlab:matlab /home/matlab/Documents/MATLAB/SupportPackages/
4. Optionally, copy an example model into the container for running confidence tests:
COPY slrt_ex_osc_rt.slx /work
5. Finalize the SLRT SPKG installation and add Speedgoat I/O Blockset by launching MATLAB during the build:
  • matlab-withSLRT.dockerfile uses matlab -batch:
# Finalize the SLRT SPKG installation & Install the Speedgoat I/O Blockset
WORKDIR /tmp/speedgoat
COPY speedgoat_io_blockset_9_9_2_R2024b_build_39601.zip /tmp/speedgoat
RUN unzip speedgoat_io_blockset_9_9_2_R2024b_build_39601.zip && \
rm speedgoat_io_blockset_9_9_2_R2024b_build_39601.zip && \
matlab -batch "slrealtime.internal.postInstallSetup;speedgoat_setup -forced -acceptEula -donotopendoc -donotrefreshlibbrowser" && \
rm -rf /tmp/speedgoat
WORKDIR /home/matlab
  • matlab-batch-withSLRT.dockerfile makes the license token available through the MLM_LICENSE_TOKEN environment variable and uses matlab-batch:
# Finalize the SLRT SPKG installation & Install the Speedgoat I/O Blockset
WORKDIR /tmp/speedgoat
ENV MLM_LICENSE_TOKEN=${MLM_LICENSE_TOKEN}
COPY speedgoat_io_blockset_9_9_2_R2024b_build_39601.zip /tmp/speedgoat
RUN unzip -q speedgoat_io_blockset_9_9_2_R2024b_build_39601.zip && \
rm speedgoat_io_blockset_9_9_2_R2024b_build_39601.zip && \
matlab-batch "slrealtime.internal.postInstallSetup;speedgoat_setup -forced -acceptEula -donotopendoc -donotrefreshlibbrowser" && \
rm -rf /tmp/speedgoat
WORKDIR /home/matlab
6. Finally, run the docker build. Because MATLAB is launched during the build, the licensing must be available.
  • For matlab-withSLRT.dockerfile, if using License Option 1, build the container with the license server hostname and port:
docker build -f matlab-withSLRT.dockerfile --build-arg LICENSE_SERVER=12345@hostname.com -t matlab:r2024b .
  • For matlab-withSLRT.dockerfile, if using License Option 2, you only need to make sure network.lic is available:
docker build -f matlab-withSLRT.dockerfile -t matlab:r2024b .
  • For matlab-batch-withSLRT.dockerfile, pass the batch license token to the Docker build process:
export MLM_LICENSE_TOKEN="user@email.com|encodedToken"
docker build -f matlab-batch-withSLRT.dockerfile --build-arg MLM_LICENSE_TOKEN="$MLM_LICENSE_TOKEN" -t matlab-non-interactive:r2024b .
.
STEP 3: Open the container and verify the installation
Open the MATLAB container with "docker run" and confirm the support packages have been installed and the confidence test build is successful with the example model:
  • For matlab-withSLRT.dockerfile, use "matlab -batch" (or run "matlab" interactively):
docker run --init --rm matlab:r2024b -batch "matlabshared.supportpkg.getInstalled;speedgoat.version;load_system('slrt_ex_osc_rt');slbuild(gcs)"
  • For matlab-batch-withSLRT.dockerfile, use "matlab-batch":
docker run --init --rm matlab-non-interactive:r2024b matlab-batch "matlabshared.supportpkg.getInstalled;speedgoat.version;load_system('slrt_ex_osc_rt');slbuild(gcs)"
The instructions above should enable you to build a container with all required support package files, and thus offload your Simulink Real-Time build activities to the CI server.

Más respuestas (0)

Categorías

Más información sobre Containers en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by