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. This works for quick tests or prototypes but is hardly 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.
Here are instructions on how to set up Docker in your computer - which is usually called development PC or simply host.
Access the Docker for Windows page on the official Docker documentation and go to Install Docker Desktop for Windows. From here you will be redirected to Docker Hub, where you can finally download Docker for Windows.
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.
Arm emulation makes it possible to run Arm instructions on x86. That is, you can run binaries compiled for the Arm instruction set on an x86 computer.
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.debian.org/debian/pool/main/b/binfmt-support/binfmt-support_2.2.0-2_amd64.deb $ wget http://ftp.debian.org/debian/pool/main/q/qemu/qemu-user-static_3.1+dfsg-8+deb10u5_amd64.deb $ sudo apt install ./binfmt-support_2.2.0-2_amd64.deb $ sudo apt install ./qemu-user-static_3.1+dfsg-8+deb10u5_amd64.deb