Select the version of your OS from the tabs below. If you don't know the version you are using, run the command cat /etc/os-release
or cat /etc/issue
on the board.
Remember that you can always refer to the Torizon Documentation, there you can find a lot of relevant articles that might help you in the application development.
Toradex provides Docker container images for Torizon that derive from a minimal variant of the Bullseye release of Debian. The purpose is to provide a hierarchy of light images with disabled manual pages and a minimalist set of installed packages that can be used as a foundation for developing customer's applications.
Toradex also provides development tools for pin configuration, display settings, performance monitoring and more, with both local and web-based remote UIs. Please refer to Torizon Related Articles to have more information.
This article complies to the Typographic Conventions for Torizon Documentation.
To have a better understanding of this article, the following prerequisites are recommended:
docker run
command options.To get the most from this article and test things in practice, we recommend that you clone the torizon-samples repository to your computer:
$ cd ~
$ git clone --branch=bullseye https://github.com/toradex/torizon-samples.git
$ cd torizon-samples/debian-container
Toradex has designed a set of Debian-based container images to serve as foundations for application development in Torizon. The containers offer interesting features such as:
Each container is built on top of a previous one, adding an increased set of features. There is a diversity of containers available in order to more closely match the minimum dependencies of applications that may be developed on top of them. As the containers are Debian based, specific packages can be further installed with the apt command as required by user's applications.
The following diagram depicts the hierarchy of these containers in TorizonCore 5. The container images can be freely retrieved from Docker Hub.
Focusing only on the Debian Containers for Torizon, you might ask yourself "what container should I choose?". It may sound hard at first, but the questions below will help you to make the right choice:
Use the torizon/debian
container. It is the simplest container ready for application development.
Choose one of the torizon/weston
variants, which come with Weston and Wayland + XWayland pre-configured.
Instead of using the torizon/weston
container, choose one of the torizon/qt5-wayland
containers.
torizon/<some-container>-vivante
variant?If you are using an i.MX 8-based SoM and you need GPU graphics acceleration, it is a good idea to choose the vivante
variant.
Besides the containers above, Toradex and partners also offer various other Container Images for Torizon, such as development tools to be executed directly in modules (e.g. device tree overlay management), as well as sample containers for demonstrating key features of Toradex hardware and useful application concepts.
There are some options. They are applicable for any container, not only the Debian Containers for Torizon:
This topic has its own article with a more detailed overview and instructions: Deploying Container Images to TorizonCore.
Our Debian container images have their own tags, and a remarkable note is that we purposefully don't use the tag latest
. We use semantic versioning for new releases of our container images, tagging the images accordingly. To learn more, read our dedicated article TorizonCore Containers Tags and Versioning.
Torizon containers are based in the official Debian slim Image.
This section gives more details about our Debian based images and how they can improve the development process. Please take a look at our base Dockerfile hosted on GitHub.
From the start of the base Dockerfile:
DockerfileARG IMAGE_ARCH=linux/arm/v7 # For arm64v8 use: # ARG IMAGE_ARCH=linux/arm64/v8 ARG IMAGE_TAG=bullseye-slim # ARG DEBIAN_SNAPSHOT=20210408T000000Z ARG TORADEX_SNAPSHOT=20210909T072507Z ARG USE_TORADEX_SNAPSHOT=1 ARG ADD_TORADEX_REPOSITORY=1 FROM --platform=$IMAGE_ARCH debian:$IMAGE_TAG AS base
Two important considerations arise from the above snippet:
docker pull --platform=<IMAGE_ARCH> ...
can be used to forcefully specify the intended architecture. Similarly, when building on top of Torizon images, docker build --pull --platform=<IMAGE_ARCH> ...
can be used to enforce the build architecture as well.The Dockerfile also adds a user and group ID to match those used by the host OS:
DockerfileRUN groupadd --gid 1000 torizon \ && useradd --gid 1000 --uid 1000 --create-home torizon
The enablement of the package repository feed provided by Toradex is performed by the following Dockerfile instructions:
DockerfileADD https://feeds.toradex.com/debian/toradex-debian-repo.gpg /etc/apt/trusted.gpg.d/ RUN chmod 0644 /etc/apt/trusted.gpg.d/toradex-debian-repo.gpg \ && echo "deb https://feeds.toradex.com/debian/ testing main non-free" >>/etc/apt/sources.list \ && echo "Package: *\nPin: origin feeds.toradex.com\nPin-Priority: 900" > /etc/apt/preferences.d/toradex-feeds
You can browse our GitHub repository toradex/debian-docker-images and see exactly what is included in each of our Debian images.
Weston is a Wayland based compositing window manager, basically the piece of software which makes sure that graphical application can be drawn alongside each other. Weston comes with a minimal launcher that allows starting a terminal, but in embedded configurations, the launcher is often disabled/hidden.
The container is Debian Bullseye release based, featuring the Weston Wayland compositor. To pull the container and start it on the module, choose your hardware from the tabs below and follow the instructions given:
(Optional) pull the torizon/weston
container image:
# docker pull torizon/weston:$CT_TAG_WESTON
Start the weston
compositor:
# docker run -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
-v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
--device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' \
--device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
torizon/weston:$CT_TAG_WESTON --developer weston-launch --tty=/dev/tty7 --user=torizon
(Optional) pull the torizon/weston
container image:
# docker pull torizon/weston:$CT_TAG_WESTON
Start the weston
compositor:
# docker run -d --rm --ipc=host --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
-v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
--device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' \
--device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
torizon/weston:$CT_TAG_WESTON --developer weston-launch \
--tty=/dev/tty7 --user=torizon -- --use-pixman
(Optional) pull the torizon/weston-vivante
container image:
# docker pull torizon/weston-vivante:$CT_TAG_WESTON_VIVANTE
Start the weston
compositor:
Attention: Please, note that by executing the following line you are accepting the terms and conditions of the NXP's End-User License Agreement (EULA)
# docker run -e ACCEPT_FSL_EULA=1 -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
-v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
--device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' \
--device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
torizon/weston-vivante:$CT_TAG_WESTON_VIVANTE --developer weston-launch \
--tty=/dev/tty7 --user=torizon
After sending the command above, Weston should start on your display and you are ready to start your Wayland applications.
If the container image is not preinstalled, Docker will download it from Docker Hub and store it on the module -- this will require an internet connection on the device and may take a few minutes. It will start Weston (HDMI on Apalis SoMs, parallel RGB on Colibri SoMs, MIPI-DSI on Verdin SoMs). The container will be started in the background, you can look at the Weston output for debugging by using the Docker logs subcommand:
# docker logs weston
Most of the arguments in this command line make sure that the container can access the necessary hardware (display controller, GPU and input devices) and be notified about hardware changes (through TorizonCore's udev daemon).
On modules without GPU like Colibri iMX7 and Colibri iMX6ULL we add weston-launch --tty=/dev/tty7 --user=torizon -- --use-pixman
to start Weston with Pixman.
Weston creates a Unix socket file so graphical client applications can communicate with it (typically in the 1000-runtime-dir
directory under /tmp). By bind mounting /tmp into a second container, a Wayland client application can access the Wayland compositor despite being in separate containers. The Wayland client application will talk to Weston (the Wayland Compositor) through the Unix socket file and draw in a window on Weston.
As an example, let's start a second container that reuses the same image, but brings up an application on top of the Wayland compositor. Select your module from the tabs below and follow the instructions:
In order to launch a container named wayland-app
and start the weston-terminal
, run this command:
# docker run -d --rm --name=wayland-app --user=torizon \
-v /dev/dri:/dev/dri -v /tmp:/tmp \
--device-cgroup-rule='c 226:* rmw' \
torizon/weston:$CT_TAG_WESTON weston-terminal
In order to launch a container named wayland-app
and start the weston-terminal
, run this command:
Attention: Please, note that by executing the following line you are accepting the terms and conditions of the NXP's End-User License Agreement (EULA)
# docker run -e ACCEPT_FSL_EULA=1 -d --rm --name=wayland-app --user=torizon \
-v /dev/dri:/dev/dri -v /dev/galcore:/dev/galcore -v /tmp:/tmp \
--device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
torizon/weston-vivante:$CT_TAG_WESTON_VIVANTE weston-terminal
Note: you are also giving access to /dev/galcore
, meaning you can leverage the Vivante graphics acceleration inside the container.
After sending the command above, Weston should start on your display with the Wayland Terminal opened.
To get a shell inside the container docker exec
can be used:
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ab83ec23855e torizon/weston:1 "/usr/bin/entry.sh e…" 31 seconds ago Up 28 seconds wayland-app
f4a426310353 torizon/weston:1 "/usr/bin/entry.sh -…" 3 minutes ago Up 3 minutes weston
# docker exec -it weston /bin/bash
This will create a prompt with root privileges inside the container.
A dedicated article, Working with Weston on TorizonCore, explains how to set up Weston with custom configuration. Among several possibilities, you can:
The Weston-based containers come ready to enable a VNC or RDP back-end that allows to remote access a Graphical User Interface (GUI). To learn more, read the article Remote Access the TorizonCore GUI Using VNC or RDP.
This section focuses on an example using Docker Compose, which makes it easy to Use Multiple Containers with TorizonCore, in contrast to the previous examples that used the docker run
command directly from the command-line, as explained on Run and Manage Containers with Portainer and the Command-line on Torizon.
At the beginning of the article, in the Prerequisites section, you have cloned the torizon-samples repository. Before we move into the explain section, go to the demonstration
folder. Make sure that you have followed the instructions provided in this article's Prerequisites first:
$ cd torizon-samples/debian-container
On the board, make sure that all containers are stopped:
# docker stop $(docker ps -a -q)
Docker-compose is used to start multiple containers at the same time, providing shared data volumes, mount points, resource usage limitations and other advantages. You can have a good experience using docker-compose to start our containers and take a glimpse of the development environment. In this case, the demo is showing a browser in kiosk-mode using three containers:
torizon/weston:2
or torizon/weston-vivante:2
: The Wayland compositor;portainer/portainer
: provides the data that should be displayed by the UI;torizon/kiosk-mode-browser:2
based on the torizon/wayland-base:2
container, it runs a browser in a kiosk-mode, allowing implementation of web-based UIs.Select your hardware in the box below:
Attention: By starting the demonstration using this docker compose file, you are accepting the NXP's End-User License Agreement (EULA).
Then you can start the demo with a single command:
# docker-compose -f <your-docker-compose-file> up
Note: With the above command, you directly attach to the containers you are about to start. To start in detached-mode, you can append -d
to the above command.
Note: To use the device_cgroup_rules configuration option we have to use Compose file version 2.4 currently.
Docker-auto-prune is a systemd service in TorizonCore, that periodically removes:
This service is disabled by default, because removing stopped container could lead to some important container loss. It’s probably not a use case for the production, but it can be useful during development. To enable it, run the following:
# sudo systemctl enable docker-auto-prune.timer
Toradex provides Debian based container images that derive from a minimal variant of the buster release of Debian. The purpose is to provide for our costumers a light image with disabled manual pages and suggested package installation, limiting dependencies only to required ones.
Our objective is also to provide development tools for pin configuration, display settings, performance monitoring and more, with both local and web-based remote UIs. Please refer to Torizon Related Articles to have more information.
This article complies to the Typographic Conventions for Torizon Documentation.
To have a better understanding of this article the following prerequisites are recommended:
docker run
command options.To get the most from this article and test things in practice, we recommend that you clone the torizon-samples repository to your computer:
$ cd ~
$ git clone https://github.com/toradex/torizon-samples.git
$ cd torizon-samples/debian-container
We provide a set of Debian-based container images with different features:
Console only base container
Container which makes use of a modern Wayland based graphics stack using the Wayland protocol and a compositor (Weston) running in a separate container
Qt-Wayland based container, a full graphics stack container image
Debian based docker container with development tools to run on the module (a.e. device tree overlay)
Each container image is based on a Debian distribution so you can pull in alternative components with apt, just need to make sure that they have the Arm architecture variant.
Warning: If you find some issues while testing any arm64v8
container image on Apalis iMX8 and Colibri iMX8X, please don't hesitate to report them. Toradex appreciates your feedback since iMX8 modules are not a very well tested platform on Torizon.
Attention: please use the tag buster-20200415
if you are using the TorizonCore Monthly release from April, a.k.a 4.0.0-devel-202004+build.3
. At the moment you should only use the tag buster
if you are using a newer release of TorizonCore.
This section is going to give you more details about our Debian based images and how they can improve your development process. Please take a look at our base Dockerfile hosted on GitHub.
We use the Debian slim Image to create our container.
DockerfileFROM $IMAGE_ARCH/debian:10.2-slim
In these two lines, a user group ID to match those used by host OS were added.
DockerfileRUN groupadd --gid 1000 torizon \ && useradd --gid 1000 --uid 1000 --create-home torizon
In the box below, a custom repository feed provided by Toradex with some useful packages was added.
DockerfileARG ADD_TORADEX_REPOSITORY=1 RUN if [ "$ADD_TORADEX_REPOSITORY" = "1" ]; then \ echo "deb https://feeds.toradex.com/debian/testing/ buster main" >> /etc/apt/sources.list ; \ echo "Package: *\nPin: origin feeds.toradex.com\nPin-Priority: 900" > /etc/apt/preferences.d/toradex-feeds ; \ fi
Weston is a Wayland based compositing window manager, basically the piece of software which makes sure that graphical application can be drawn alongside each other. Weston comes with a minimal launcher that allows starting a terminal, but in embedded configurations, the launcher is often disabled/hidden.
The container is Debian buster release based, featuring the Weston Wayland compositor. To pull the container and start it on the module, choose your hardware from the tabs below and follow the instructions given:
Start weston
using the torizon/arm32v7-debian-weston:buster
container image:
# docker run -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
-v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
--device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' --device-cgroup-rule='c 226:* rmw'\
torizon/arm32v7-debian-weston:buster --developer weston-launch --tty=/dev/tty7 --user=torizon
Start weston
using the torizon/arm32v7-debian-weston:buster
container image:
# docker run -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
-v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
--device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' --device-cgroup-rule='c 226:* rmw' \
torizon/arm32v7-debian-weston:buster --developer weston-launch --tty=/dev/tty7 --user=torizon -- --use-pixman
Start weston
using the torizon/arm64v8-debian-weston-vivante:buster
container image:
Attention: Please, note that by executing the following line you are accepting the terms and conditions of the NXP's End-User License Agreement (EULA)
# docker run -e ACCEPT_FSL_EULA=1 -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
-v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
--device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
torizon/arm64v8-debian-weston-vivante:buster --developer weston-launch --tty=/dev/tty7 --user=torizon
Since the container image is not preinstalled, Docker will download it from Docker Hub and store it on the module. This will require an internet connection on the device and may take a few minutes. It will start Weston (HDMI on Apalis SoMs, parallel RGB on Colibri SoMs, MIPI-DSI on Verdin SoMs). The container will be started in the background, you can look at the Weston output for debugging by using the Docker logs subcommand:
# docker logs weston
Most of the arguments in this command line make sure that the container can access the necessary hardware (display controller, GPU and input devices) and be notified about hardware changes (through TorizonCore's udev daemon).
On modules without GPU like Colibri iMX7 we add weston-launch --tty=/dev/tty7 --user=torizon -- --use-pixman
to start Weston with Pixman.
Weston creates a Unix socket file so graphical client applications can communicate with it (typically in the 1000-runtime-dir
directory under /tmp). By bind mounting /tmp into a second container, a Wayland client application can access the Wayland compositor despite being in separate containers. The Wayland client application will talk to Weston (the Wayland Compositor) through the Unix socket file and draw in a window on Weston.
As an example, let's start a second container that reuses the same image, but brings up an application on top of the Wayland compositor. Select your module from the tabs below and follow the instructions:
In order to launch a container named wayland-app
and start es2gears
, run this command:
# docker run -d --rm --name=wayland-app --user=torizon \
-v /dev/dri:/dev/dri -v /tmp:/tmp \
--device-cgroup-rule='c 226:* rmw' \
torizon/arm32v7-debian-weston:buster es2gears_wayland
In order to launch a container named wayland-app
and start the weston-terminal
, run this command:
Attention: Please, note that by executing the following line you are accepting the terms and conditions of the NXP's End-User License Agreement (EULA)
# docker run -e ACCEPT_FSL_EULA=1 -d --rm --name=wayland-app --user=torizon \
-v /dev/dri:/dev/dri -v /dev/galcore:/dev/galcore -v /tmp:/tmp \
--device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
torizon/arm64v8-debian-weston-vivante:buster weston-terminal
Note: you are also giving access to /dev/galcore
, meaning you can leverage the Vivante graphics acceleration inside the container.
To get a shell inside the container docker exec
can be used:
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ab83ec23855e torizon/arm32v7-debian-weston:buster "/usr/bin/entry.sh e…" 31 seconds ago Up 28 seconds wayland-app
f4a426310353 torizon/arm32v7-debian-weston:buster "/usr/bin/entry.sh -…" 3 minutes ago Up 3 minutes weston
# docker exec -it weston /bin/bash
This will create a prompt with root privileges inside the container.
Before we move into the explain section, go to the demonstration
folder:
$ cd demonstration
On the board, make sure that all containers are stopped:
# docker stop $(docker ps -a -q)
Docker-compose is used to start multiple containers at the same time, providing shared data volumes, mount points, resource usage limitations and other advantages. You can have a good experience using docker compose to start our containers and take a glimpse of the development environment, in this case, the demo is showing a browser in kiosk-mode using three containers:
Weston: Wayland compositor
Portainer: provides the data that should be displayed by the UI
Kiosk-mode-browser: based on torizon- arm32v7-debian-wayland container, that can be used to run a browser in a kiosk-mode, allowing implementation of web-based UIs
Select your hardware in the box below:
Note: Use "-e ACCEPT_FSL_EULA=1" to accept the NXP EULA or set the environment variable on every invocation by uncommenting the corresponding line in "docker-compose.arm64.yml".
Then you can start the demo with a single command:
# docker-compose -f <your-docker-compose-file> up
Note: With the above command, you directly attach to the containers you are about to start. To start in detached-mode, you can append -d
to the above command.
Note: To use the device_cgroup_rules configuration option we have to use Compose file version 2.4 currently.