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.
In this article, we cover how to use TorizonCore Builder Tool to pre-provisioning Docker Containers onto a TorizonCore image to be deployed on several units either in a production line using Toradex Easy Installer.
The workflow described in this article adds container images to the actual image tarball that can be flashed to the hardware for production programming. It is different from how container updates are applied with Torizon OTA: from the Torizon OTA dashboard, once you upload your Docker Compose file, the running TorizonCore OS will pull the containers during runtime and replace the current pre-existent Docker Compose file.
In summary, here's when you should use each:
Read the article Deploying Container Images to TorizonCore for a more comprehensive overview of all the methods for deploying containers to a TorizonCore image on various steps of the development cycle.
This article complies to the Typographic Conventions for Torizon Documentation.
The pre-requisite to complete these instructions are:
A Docker Compose file, which points to a local or remote registry containing the containers to be pre-provisioned.
A .tar file containing the TorizonCore Image with no-container pre-provisioned for offline instalation
Prerequisites from Configure Build Environment for Torizon Containers installed.
To use TorizonCore Builder, you need to create an alias. Follow the installation instructions on the TorizonCore Builder article. Make sure to unpack the TorizonCore image, as explained in the article.
Make sure to use an empty working directory and navigate to it. This directory is shared (bind-mounted) with the container this tool runs in, and it stores temporary files and the final image.
The process of preinstall or pre-provision Docker Containers onto a TorizonCore image with a Docker engine comprises two stages:
Bundle the Docker Containers: This step creates a tarball containing all the containers as well as a Docker Compose file, which references those containers using a specific hash.
Combine the Docker Containers Bundle with a TorizonCore image: In this step, the script takes a Toradex Easy Installer image of TorizonCore with the Docker engine and combines it with the previously bundled Docker Containers.
Copy your project's docker-compose.yml
file to the working directory.
As an example, we will use a simple docker-compose file:
docker-compose.ymlversion: '2.4' services: hello-world: image: hello-world
With the files on the directory, call the bundle command to create a container bundle:
$ torizoncore-builder bundle --host-workdir=$(pwd) --platform=linux/arm/v7 --file docker-compose.yml
$ torizoncore-builder bundle --host-workdir=$(pwd) --platform=linux/arm64 --file docker-compose.yml
Note: The container bundle tarball will be located at the new directory ./bundle/
.
Before running this step, make sure to have the Docker image tarball available in your work directory, as explained earlier, and the TorizonCore image directory.
To combine the container images bundle with TorizonCore image:
$ torizoncore-builder combine --image-directory ./image --output-directory ./image_output
After running this process, a combined TorizonCore image is available in the output directory specified by the --output-directory
flag. This image is ready to be installed into the SoM using Toradex Easy Installer
This article shows how to preinstall or pre-provision a Docker Containers onto a TorizonCore image with a Docker engine. This process is especially useful when preparing an image to be flashed on several units in production.
In this article, we show how to preinstall a Docker Container onto a TorizonCore image using either a Linux Host PC or a Windows machine.
The process comprises two stages:
Bundle the Docker Containers: This step creates a tarball containing all the containers as well as a Docker Compose file, which references those containers using a specific hash.
Combine the Docker Containers Bundle with a TorizonCore image: In this step, the script takes a Toradex Easy Installer image of TorizonCore with the Docker engine and combines it with the previously bundled Docker Containers.
The process makes use of Docker in Docker, which requires the script to have access to the host Docker engine.
This article complies to the Typographic Conventions for Torizon Documentation.
The pre-requisite to complete these instructions are:
A Docker Compose file, which points to a local or remote registry containing the containers to be pre-provisioned.
A .tar file containing the TorizonCore Image with no-container pre-provisioned for offline instalation
Prerequisites from Configure Build Environment for Torizon Containers installed.
Make sure to use an empty working directory and navigate to it. This directory is shared (bind-mounted) with the container this tool runs in, and it stores temporary files and the final image.
$ mkdir ~/myworkdir/
$ cd ~/myworkdir/
Inside the myworkdir
directory, create the image
and image_output
folders.
$ mkdir image image_output
For convenience, create an alias called torizoncore-builder
for the container execution:
$ alias torizoncore-builder='docker run --rm -it -v $(pwd):/workdir --net=host \
-v /var/run/docker.sock:/var/run/docker.sock torizon/torizoncore-builder'
Note: The bind mounts of the host Docker need to match the location inside the torizoncore-builder script (/builder). For that reason, you should use this alias (torizoncore-builder
) only in this directory which it was created.
Copy your project's docker-compose.yml
file to the working directory.
As an example, we will use a simple docker-compose file:
docker-compose.ymlversion: '2.4' services: hello-world: image: hello-world
Add the .tar file containing the TorizonCore Image with no-container pre-provisoned for offline instalation to the image
directory.
After copying these two files to the working directory, we check its content:
$ tree .
.
├── docker-compose.yml
├── image
│ └── teziimage.tar
└── image_output
With the files on the directory, call the bundle command to create a container bundle:
$ torizoncore-builder bundle --host-workdir=$(pwd) --platform=linux/arm/v7 --file docker-compose.yml
Attention: Replace --platform=linux/arm/v7
by --platform=linux/arm/v8
when using a 64-bit SoC (iMX8).
This step downloads the Docker in Docker container image and uses the docker-compose.yml template to download all images referenced in this Docker Compose file. The tool then compresses the complete set of Docker containers on a tar
file.
The container bundle tarball will be located at the new directory ./bundle/
.
Before running this step, make sure to have a TorizonCore image tarball available in your work directory, as explained earlier.
To combine the container images bundle with TorizonCore image:
$ torizoncore-builder combine --image-directory ./image --output-directory ./image_output
After running this process, a combined TorizonCore image is available in the output directory specified by the --output-directory
flag. This image is ready to be installed into the SoM using Toradex Easy Installer
Warning: This procedure requires Windows 10 with WSL2 installed
To execute the following instructions, the Windows Subsystem for Linux version 2(WSL2) is necessary. WSL2 is available when updating Windows 10 to the version 2004 (Build 19041) or higher.
Open the Windows command prompt (cmd) and make sure to use an empty working directory and navigate to it. This directory is shared (bind-mounted) with the container this tool runs in, and it stores temporary files and the final image.
C:\Users\My User>mkdir myworkdir/
C:\Users\My User>cd myworkdir/
C:\Users\My User\myworkdir>
Inside the myworkdir
directory, create the image
and image_output
folders.
C:\Users\My User\myworkdir>mkdir image
C:\Users\My User\myworkdir>mkdir image_output
Copy your project's docker-compose.yml
file to the working directory.
As an example, we will use a simple docker-compose file:
docker-compose.ymlversion: '2.4' services: hello-world: image: hello-world
Add the .tar file containing the TorizonCore Image with no-container pre-provisoned for offline instalation to the image
directory.
After copying these two files to the working directory, we check the myworkdir
directory content:
├── docker-compose.yml
├── image
│ └── teziimage.tar
└── image_output
With the files on the directory, call the bundle command to create a container bundle:
C:\Users\My User\myworkdir>docker run --rm -it --net=host ^
-v "C:\Users\My User\myworkdir":/workdir -v /var/run/docker.sock:/var/run/docker.sock ^
torizon/torizoncore-builder bundle --host-workdir="/c/Users/My User/myworkdir" ^
--platform=linux/arm/v7 --file docker-compose.yml
Attention: Replace --platform=linux/arm/v7
by --platform=linux/arm/v8
when using a 64-bit SoC (iMX8).
This step downloads the Docker in Docker container image and uses the docker-compose.yml template to download all images referenced in this Docker Compose file. The tool then compresses the complete set of Docker containers on a tar
file.
The container bundle tarball will be located at the new directory ./bundle/
.
Before running this step, make sure to have a TorizonCore image tarball available in your work directory, as explained earlier.
To combine the container images bundle with TorizonCore image:
C:\Users\My User\myworkdir>docker run --rm -it --net=host ^
-v "C:\Users\My User\myworkdir":/workdir -v /var/run/docker.sock:/var/run/docker.sock ^
torizon/torizoncore-builder combine --image-directory image ^
--output-directory image_output
After running this process, a combined TorizonCore image is available in the output directory specified by the --output-directory
flag. This image is ready to be installed into the SoM using Toradex Easy Installer