Skip to main content
Associate
September 6, 2024
Solved

How to install STM32CubeCLT in docker container?

  • September 6, 2024
  • 8 replies
  • 7082 views

Hello

I am new to this forum, so if I am at the wrong place, let me know.

How can this software: https://www.st.com/en/development-tools/stm32cubeclt.html be installed from a script? Namely into docker container?

I get the following error:

``` DISPLAY not set. Cannot display license. Aborting. ```

Thanks in advance.

Best answer by Stefan1

Try setting this env:

LICENSE_ALREADY_ACCEPTED=1

 

It works for STM32CubeIDE.

8 replies

Pavel A.
Super User
September 7, 2024

What if you just install cubeclt on a normal linux machine with a display (yes, manually), then copy the stuff into container, post the result to your container server and be done with it?

 

claAuthor
Associate
September 9, 2024

Thanks for the suggestion. I will consider this.

I was wondering, though, if there is no way to do it automatically, as I would like to build the container automatically from a script as well. Is this really an edge-use-case? I would have thought, that the installer would provide a way to accept the license agreement from a script? I tried `echo y | install_script` and the like. It does not work.

If there is no way, where to post the feature request?

Thanks.

Pavel A.
Super User
September 9, 2024

@mƎALLEm could you look at this request? Is there a "legal" way to bypass the license annoyance for headless installation?

Stefan1
Stefan1Best answer
Associate II
September 9, 2024

Try setting this env:

LICENSE_ALREADY_ACCEPTED=1

 

It works for STM32CubeIDE.

claAuthor
Associate
September 10, 2024

Final command:
```
unzip ./en.st-stm32cubeclt_1.16.0_xxxxx.sh.zip && \
chmod +x ./st-stm32cubeclt_1.16.0_xxxxx.sh && \
echo | sudo LICENSE_ALREADY_ACCEPTED=1 ./st-stm32cubeclt_1.16.0_xxxxx.sh
```

`echo` sends newline to accept default install directory (there might be a better approach, but this worked).

Explorer
December 18, 2024

That's a good solution as well. Honestly, it's probably the cleaner solution.

I ended up just using an expect script to install on a devcontainer. Ensure you install procps-ng and expect before you run it if you do it this way. Then just remove the packages after it's installed. Here's the expect script.

#!/usr/bin/expect

# Path to your shell script
set script "/tmp/st-stm32cubeclt_1.17.0_23554_20241124_1810_amd64.sh"

# Start the script
spawn $script --nox11

# Automatically handle the --More-- paging prompt
expect {
-re "--More--" {
send "q"
exp_continue
}
-re {\[[NY]/[yn]\]}
{
send "y\n"
exp_continue
}
-re {STM32CubeCLT install dir\?}
{
send "/opt/st/stm32cubeclt_1.17.0\n"
exp_continue
}
}
# Wait for the script to finish
expect eof
Pavel A.
Super User
March 23, 2025

Why not to use a custom container image with certain CubeIDE version already installed and tweaked up as needed? Anyway you have to keep the copy of CubeIDE installer in your private storage because downloading it from ST requires login.

 

Associate II
March 24, 2025

It is exactely what we do.

Visitor II
October 15, 2025

Evening everyone,

This is something we have been using in our company for a while now when doing CI-pipelines and deploying devcontainer tools for our employees. For some reason I previously dug the tools from CubeIDE package, which works also pretty good. 

In this approach only the absolutely mandatory stuff is put inside the container. There are some libraries which could be removed, but 2,3gig image is not that bad, since it serves its purpose as a build container.

We use CMake and Ninja for building our FW and started that before STM had proper tooling for VS Code, so basically it is vanilla setup.

1. Download the cubeclt package for debian.

2. Save this to Dockerfile in a separate folder with the .zip of CubeCLT

3. docker build -t cubeclt .

 

FROM debian:bookworm-slim AS basecontainer

ARG CUBECLT=st-stm32cubeclt_1.19.0_25876_20250729_1159_amd64.deb_bundle

ENV LICENSE_ALREADY_ACCEPTED=1

WORKDIR /workdir
COPY ${CUBECLT}.sh.zip .
RUN apt update && apt install unzip && unzip ${CUBECLT}.sh.zip && chmod 777 ./${CUBECLT}.sh && ./${CUBECLT}.sh --tar xvf \
 && rm ${CUBECLT}.sh.zip \
 && rm ${CUBECLT}.sh && ./setup.sh && rm -rf *

## Fresh container for the final build
FROM debian:bookworm-slim AS cubeclt

LABEL maintainer="Juha Viitanen <juha.viitanen@exertus.fi>"
LABEL purpose="STM32 H7 basecontainer"
LABEL version="1.0"
LABEL description="This Docker container sets up STM32CubeIDE and STM32 build tools for development."
LABEL user="exertus"
# Install local user
ARG USERNAME=exertus
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME \
 && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
 && usermod -aG root $USERNAME

# Install environmental variables
ENV CMAKE_INSTALL_PREFIX=/opt/toolchain/arm-none-eabi
ENV TOOLCHAIN_DIR=${CMAKE_INSTALL_PREFIX}
ENV PREFIX=${CMAKE_INSTALL_PREFIX}
ENV CROSS_COMPILE=arm-none-eabi-
ENV CC=${CROSS_COMPILE}gcc
ENV CXX=${CROSS_COMPILE}g++
ENV LD=${CROSS_COMPILE}ld
ENV AR=${CROSS_COMPILE}ar
ENV AS=${CROSS_COMPILE}as
ENV STRIP=${CROSS_COMPILE}strip
ENV PATH=${PATH}:${TOOLCHAIN_DIR}/bin

RUN mkdir /opt/toolchain
# Copy toolchain and required applications for previous container
COPY --from=basecontainer /opt/st/stm32cubeclt_1.19.0/GNU-tools-for-STM32 ${TOOLCHAIN_DIR}
COPY --from=basecontainer /opt/st/stm32cubeclt_1.19.0/STM32CubeProgrammer /usr/

# Package installation
RUN apt-get update \
 && apt-get install -y tzdata locales ca-certificates\
 && echo "Europe/Helsinki" > /etc/timezone \
 && ln -sf /usr/share/zoneinfo/Europe/Helsinki /etc/localtime \
 && dpkg-reconfigure -f noninteractive tzdata \
 # Install tools
 && apt-get install --no-install-recommends -y unzip zip ninja-build\
 # STM CUBE Programmer dependencies
 libglib2.0-dev libusb-1.0-0 libgssapi-krb5-2 \
 # Build tools
 cmake make git \
 # Sudo
 sudo \
 # Default user exertus for sudoers, if local user is used
 && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
 && chmod 0440 /etc/sudoers.d/$USERNAME \
 # Remove cache
 && apt-get clean && rm -rf /var/lib/apt/lists/* 

 

Visitor II
December 15, 2025

Hi,

I would like to create a devcontainer workspace to develop stm32 applications. I found that when I install stm32 vscode extension it can install every needed libraries like cmake, debugger etc. Is it possbile to pre install these into the docker file? I don't want to install manually every docker container creation.

Associate II
December 15, 2025

Hi,

I'm not sure to understand the issue. The Dockerfile is here to add whatever you need in your container.

So, yes you can add what you want in your docker image.

Visitor II
December 15, 2025

I know that I can add everything into the dockerfile. My problem is that I don't know what vscode installs when I click yes during the extension installation.

Visitor II
December 15, 2025

I'am a little bit confused. Why CubeCLT is needed for VsCode development? When I install CubeCLT the extension still would like to install these bundles and without installation it would failed to setup the project.

About to install following cube bundle(s): stlink-upgrader@3.16.8+st.3 - stlink-server@2.1.1+st.7 - stlink-gdbserver@7.11.0+st.1 - st-arm-clangd@19.1.2+st.3 - rtos-proxy@0.17.0+st.3 - programmer@2.20.0 - pack-manager-snapshot@2025.8.6 - pack-manager@0.3.12 - node@20.19.4+st.1 - ninja@1.13.1+st.1 - gnu-tools-for-stm32-13_3_1-description@1.0.1+st.1 - gnu-tools-for-stm32@13.3.1+st.9 - gnu-gdb-for-stm32@13.3.1+st.10 - cube-code-manifest@1.0.6+st.1 - cube-code-doc@0.0.5+st.1 - cube-cmsis-scanner@1.1.3 - cmake@4.0.1+st.3 - adoptium-jre@17.0.15+6.st.1

 

But when I install just the bundles everything is working without the need of CubeCLT.

Visitor II
December 15, 2025

Hi Janos,

If you do not have any needs for implementing stuff for CI/CD-pipelines or deploying same environment to multiple ie. team members exactly the same, then having a Docker and devcontainer is not required. You can use like you described.

Many projects specially in commercial side have started to develop before there were such a large ecosystem of plugins for VS Code.

 

br.

Juha

Visitor II
December 15, 2025

Hi Juha,

I need what you described. I would like to create CI/CD pipeline, have a common dev environment and use it for CI also. Previously I worked with vscode+devcontainer for ROS2 application development. It was very useful that all of the used tools was preinstalled, the workspace was setup to run build, static code analysis, tests and etc. 

I would like to do the same with stm32. Just install docker, vscode and launch the devcontainer.

Visitor II
December 15, 2025

Have a look at this repo, it was a huge help for me when designing the project layout.

https://github.com/jasonyang-ee/STM32-CMAKE-TEMPLATE

Visitor II
January 13, 2026

Now I have a docker container with running compile with cmake, clangd also working. The biggest problem the debug. I have Jlink debugger. Installed the cortex debug extension. But I cannot use it properly. I start the gdb server on host side, connect from docker. It is working. The issue is that when start the debug only compare the elf with the flash data but not flashing. How to solve this issue? I searched in google without any success solution.