Torizon supports the docker runtime and this will allow you to run your applications inside containers. It is possible to build and configure containers directly on the target, but this works for quick tests or prototypes but is not suitable for projects that need to be maintained over time.
In this case, you should define the configuration steps required to initialize your container (installing packages, changing configuration files, adding application-specific content) in a Dockerfile and use it to build the container on your development machine. To be able to build containers that can run on a different processor architecture (your development machine will likely use an x86/x64 processor while Toradex's modules have ARM SOCs) you will need to correctly configure the docker environment.
This article complies to the Typographic Conventions for Torizon Documentation.
Note: Instructions for Linux machines focus on Debian-based distros.
The release of Docker provided by some distribution is not up to date, to be sure that you install docker in the correct way please go to docker website and follow instructions for your OS/distribution.
You don't need to install the experimental version, but keeping the docker setup up to date would help you avoid issues that have been already fixed in the latest stable release.
You will need to add your user to the docker group to allow you to run docker client without needing root privileges.
The specific command used to perform this operation may be different, depending on your distribution.
On Debian-based distributions, like Ubuntu, you should use the
$ sudo addgroup <your user name> docker
You will have to logout and login to see the change applied. You can list the groups that contain your user account by typing
groups in the shell.
If you use Windows then ARM emulation is enabled by default in docker.
If you use Linux you'll have to enable it, using the binfmt kernel feature to use qemu-static to run native arm binaries that are inside your container.
Enabling those features is distribution specific.
Ubuntu 18.04 and other Debian-based distribution may not yet provide the required versions of binfmt-utils (2.2) and qemu-user-static (3.1) that are required to run ARM docker containers on x64 machines. To enable this features you have to explicitely download those packages from the latest debian releases and install them from the .deb file.
$ wget http://ftp.us.debian.org/debian/pool/main/b/binfmt-support/binfmt-support_2.2.0-2_amd64.deb $ wget http://ftp.us.debian.org/debian/pool/main/q/qemu/qemu-user-static_3.1+dfsg-8+deb10u2_amd64.deb $ sudo apt install ./binfmt-support_2.2.0-2_amd64.deb $ sudo apt install ./qemu-user-static_3.1+dfsg-8+debi10u2_amd64.deb