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 Intel x86-64 architectures. That is, you can run binaries compiled for the Arm instruction set on an x86 computer.
To enable this emulation to be used with Docker, run the following command:
Note: use the same command for Windows (Docker Desktop Hyper-V VM or Docker Desktop using WSL 2 as backend) and Linux distributions.
$ docker run --rm -it --privileged torizon/binfmt
Warning: This operation will run a privileged container, this will run for the time required to enable Arm emulation using binfmt. It should be a safe operation.
This command will install and register the interpreters that will know how to run the
arm64v8 instructions on your Intel x86 development PC. This use the Kernel Linux support for miscellaneous binary formats feature.
To test wheter the interpreters have been successfully installed, run the commands:
$ docker run --rm -it arm32v7/debian arch
The return must be:
$ docker run --rm -it arm64v8/debian arch
The return must be: