Toradex Debian Image
Overview
Toradex provides minimal container images that extend the slim release of Debian with useful features for TorizonCore, limiting dependencies and packages only for the required ones.
See Debian Container for Torizon page to find more information about the available images and how to use them.
In this section you will:
- Learn a simple way to pull a Toradex container image from the server.
- Learn a simple way to start and use a container based on the pulled image.
- See how to install a simple Debian package on the container and test it.
- Learn the limitations of this method and why you need to write a Dockerfile to build your own image based on existing Toradex images.
Typographic Conventions
Throughout the Toradex documentation, the following typographic conventions are used:
$ (dollar sign) Command in the host computer (e.g. your PC)
$ Command in your PC
$$ (double dollar sign) Command in a container in the host computer (e.g. your PC)
$$ Command inside a container in your PC
# (hashtag) Command in the target device/board (e.g. Linux terminal)
# Command in the target board, e.g. Colibri iMX6
## (double hashtag) Command inside a container in the target device (Torizon)
## Command inside a container in Torizon
> (greater-than sign) Command in the bootloader (e.g. U-Boot console)
> Command in the Bootloader
No symbol: Command output
$ Command waiting for output
Output
Prerequisites
Step 1
On module's terminal, pull Toradex's Debian image:
# docker pull torizon/debian:$CT_TAG_DEBIAN
The command above downloads and stores a container image in its latest version to be used on the board.torizon/debian
is a minimal Debian-based image intended to be used on Toradex's Computer on Modules (COMs). The $CT_TAG_DEBIAN
is a Torizon-specific environment variable meant to make it easier to run containers matching the OS release version.
Step 2
Instantiate and run a new container based on the pulled image:
# docker run --rm -it -v /var/run/dbus:/var/run/dbus -v /dev:/dev torizon/debian:$CT_TAG_DEBIAN bash
The flags on this command give the container the necessary permissions to access hardware features from the host. For more information about what these flags do, see the FAQ session at the end of this article.
Step 3
Now the container is running interactively and its terminal is shown. Update the list of available packages:
## apt update
Step 4
Use the apt install
command inside the container to install the nano
text editor, for instance:
## apt install nano
Step 5
Check that the package you've installed is available:
## nano
You are now inside the nano
text editor. Press Ctrl + x
to exit it.
Step 6
You can exit the container by either typing exit
on the command-line or by pressing Ctrl + d
:
## exit
Takeaway
You are now ready to start working with a container. You may want to install and run applications inside this container we just created. However, note that all the applications installed and all the data modifications made after the start of a container will be lost when this container exits (i.e. stops its execution). For this reason, the method shown in this article may be useful for debugging/test, but it is not practical for development.
In the next sections of this tutorial, you will learn how to install Docker in your development PC, learn proper ways to develop applications for TorizonCore and put them inside container images.
FAQ
What do the `docker run` flags do?
-d
makes the container run in detached mode, i.e. in the background.-it
makes it interactive.--rm
removes the container after it is finished-v /var/run/dbus:/var/run/dbus -v /dev:/dev
links the board's files that control the display with the container's.
Are all packages from Debian available on the board?
Debian feeds are used, therefore all packages available for the module's architecture (e.g. ARMv7 a.k.a ARM, or ARMv8 a.k.a ARM64 depending on your module) are available on the board. Packages available only for x86 will be missing.
Can I run 32-bit containers on 64-bit platforms?
Preliminary tests show that it's possible, though you're encouraged to use the 64-bit version whenever possible.
What is the difference between a Docker image and container?
An image is a read-only, stateless template, whereas a container is a running instance of it. More than one container can be run from the same image.
For comprehensive information, go through the Docker documentation. For instance, in the Docker overview, there is a section that defines what are images and containers.