Docker Image does not integrate the packages added in the Dockerfile (release arm64)

torizon@verdin-imx8mp-15229850:~$ sudo tdx-info
Password:

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.148-6.6.1+git.23a8e831749d #1-TorizonCore SMP PREEMPT Thu Feb 29 20:25:21 UTC 2024
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/f5f0b9e40c1595ab904ce493a792a0b54e17f0dc3ce6832ddb889452bdd13704/0
Distro name:              NAME="TorizonCore"
Distro version:           VERSION_ID=6.6.1-build.14
Distro variant:           VARIANT="Docker"
Hostname:                 verdin-imx8mp-15229850
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Plus WB on Verdin Development Board
Toradex version:          0058 V1.1B
Serial number:            15229850
Processor arch:           aarch64
------------------------------------------------------------
[Hardware Configuration]
Verdin iMX8M Plus Evaluation Kit with Touchscreen
with:
SOM i.MX8M Plus Quad 4GB WB IT v1.1B
Dahlia Carrier Board v1.1D
Verdin DSI to LVDS rev 1.1A
Capacitive Touch Display 10.1" v1.0A

I use the Torizon IDE extension version v2.5.1 and VS Code 1.90.1 on my Windows 11 Business 23H2.

VS Code
Version: 1.90.1 (user setup)
Commit: 611f9bfce64f25108829dd295f54a6894e87339d
Date: 2024-06-11T21:01:24.262Z
Electron: 29.4.0
ElectronBuildId: 9593362
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22631

The Dockerfile of my CMake C++ project is as below:

I have just added the installation of procps package which contains ps and top utilities.

I am using it for interactive tests when I run my docker image on my target (Verdin ;.MX 8M Plus)

ARG CROSS_SDK_BASE_TAG=3.2.1-bookworm
ARG BASE_VERSION=3.2.1-bookworm
##
# Board architecture
# arm or arm64
##
ARG IMAGE_ARCH=

##
# Directory of the application inside container
##
ARG APP_ROOT=


# BUILD ------------------------------------------------------------------------
FROM torizon/debian-cross-toolchain-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} As Build

ARG APP_ROOT
ARG IMAGE_ARCH

# __deps__
RUN apt-get -q -y update && \
    apt-get -q -y install \
    cmake \
    procps \
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
    # __torizon_packages_dev_start__
    # __torizon_packages_dev_end__
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
    && \
    apt-get clean && apt-get autoremove && \
    rm -rf /var/lib/apt/lists/*
# __deps__

COPY . ${APP_ROOT}
WORKDIR ${APP_ROOT}

# Remove the code from the debug builds, inside this container, to build the
# release version from a clean build
RUN rm -rf ${APP_ROOT}/build-${IMAGE_ARCH}

RUN if [ "$IMAGE_ARCH" = "arm64" ] ; then \
        cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -Bbuild-${IMAGE_ARCH} ; \
    elif [ "$IMAGE_ARCH" = "arm" ] ; then \
        cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -Bbuild-${IMAGE_ARCH} ; \
    fi

RUN cmake --build build-${IMAGE_ARCH}

# BUILD ------------------------------------------------------------------------


# DEPLOY -----------------------------------------------------------------------
FROM --platform=linux/${IMAGE_ARCH} torizon/debian:${BASE_VERSION} AS Deploy

ARG IMAGE_ARCH
ARG APP_ROOT

RUN apt-get -y update && apt-get install -y --no-install-recommends \
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
    # __torizon_packages_prod_start__
    # __torizon_packages_prod_end__
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
	&& apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*

# Copy the application compiled in the build step to the $APP_ROOT directory
# path inside the container, where $APP_ROOT is the torizon_app_root
# configuration defined in settings.json
COPY --from=Build ${APP_ROOT}/build-${IMAGE_ARCH}/bin ${APP_ROOT}

# "cd" (enter) into the APP_ROOT directory
WORKDIR ${APP_ROOT}

# Command executed in runtime when the container starts
CMD ["./skeleton-poolcop-app"]

# DEPLOY -----------------------------------------------------------------------

When I list my images on my WSL2 Ubuntu 22.04.4 LTS, I have the following list:

So, my image is not in the list which is normal since I have just removed it. (docker rmi .

Now, I clean my arm64 build and after I build the container release arm64 by doing so:

After, I list once again my docker images on my WSL2 Ubuntu 22.04:

I see in the list that there is an new image which appears, which has been created 17 hours ago.
The name of my application is skeleton-poolcop-app.
There is cross-toolchain-arm64-skeleton-poolcop-app in the list, but honestly I would like to know what this image is corresponding to, because in my mind of application programmer, clean-arm64 or the clean process, more generally, means usually the deletion of the files generated during the build process, like the object files (compilation of *.c and *.cpp into .o) and the result of the linkage (skeleton-poolcop-app).

There’s definitely something I’m confusing terminology with. But, let’s continue.
After, as I do not want to debug my application, but build it in release mode to make it the smallest one, as well as the image, I click on the task named “build-container-torizon-release-arm64”.

 *  Executing task: DOCKER_HOST= docker compose build --pull --build-arg SSHUSERNAME=torizon --build-arg APP_ROOT=/home/torizon/app --build-arg IMAGE_ARCH=arm64 --build-arg GPU=-vivante skeleton-poolcop-app 

WARN[0000] The "LOCAL_REGISTRY" variable is not set. Defaulting to a blank string. 
WARN[0000] /home/flepron/dev/skeleton-poolcop-app/docker-compose.yml: `version` is obsolete 
[+] Building 1.0s (17/17) FINISHED                                                                                                                                                                            docker:default
 => [skeleton-poolcop-app internal] load build definition from Dockerfile                                                                                                                                               0.0s
 => => transferring dockerfile: 2.56kB                                                                                                                                                                                  0.0s
 => [skeleton-poolcop-app internal] load metadata for docker.io/torizon/debian:3.2.1-bookworm                                                                                                                           0.8s
 => [skeleton-poolcop-app internal] load metadata for docker.io/torizon/debian-cross-toolchain-arm64:3.2.1-bookworm                                                                                                     0.8s
 => [skeleton-poolcop-app internal] load .dockerignore                                                                                                                                                                  0.0s
 => => transferring context: 56B                                                                                                                                                                                        0.0s
 => [skeleton-poolcop-app build 1/7] FROM docker.io/torizon/debian-cross-toolchain-arm64:3.2.1-bookworm@sha256:e82fb5bd44dd76b65a2ce09e356036cac569384643e4535e3d546459377a8994                                         0.0s
 => [skeleton-poolcop-app internal] load build context                                                                                                                                                                  0.1s
 => => transferring context: 27.66kB                                                                                                                                                                                    0.0s
 => [skeleton-poolcop-app deploy 1/4] FROM docker.io/torizon/debian:3.2.1-bookworm@sha256:c645d6bc14f7d419340df0be25dbbe115ada029fa2e502a1c9149f335c59fc08                                                              0.0s
 => CACHED [skeleton-poolcop-app deploy 2/4] RUN apt-get -y update && apt-get install -y --no-install-recommends  && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*                                 0.0s
 => CACHED [skeleton-poolcop-app build 2/7] RUN apt-get -q -y update &&     apt-get -q -y install     cmake     procps     &&     apt-get clean && apt-get autoremove &&     rm -rf /var/lib/apt/lists/*                0.0s
 => CACHED [skeleton-poolcop-app build 3/7] COPY . /home/torizon/app                                                                                                                                                    0.0s
 => CACHED [skeleton-poolcop-app build 4/7] WORKDIR /home/torizon/app                                                                                                                                                   0.0s
 => CACHED [skeleton-poolcop-app build 5/7] RUN rm -rf /home/torizon/app/build-arm64                                                                                                                                    0.0s
 => CACHED [skeleton-poolcop-app build 6/7] RUN if [ "arm64" = "arm64" ] ; then         cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -Bbuild-a  0.0s
 => CACHED [skeleton-poolcop-app build 7/7] RUN cmake --build build-arm64                                                                                                                                               0.0s
 => CACHED [skeleton-poolcop-app deploy 3/4] COPY --from=Build /home/torizon/app/build-arm64/bin /home/torizon/app                                                                                                      0.0s
 => CACHED [skeleton-poolcop-app deploy 4/4] WORKDIR /home/torizon/app                                                                                                                                                  0.0s
 => [skeleton-poolcop-app] exporting to image                                                                                                                                                                           0.0s
 => => exporting layers                                                                                                                                                                                                 0.0s
 => => writing image sha256:7df66a04638341d8444ca33f3c028dacec400cddc65409ac0a4f5b7a8ce0ae59                                                                                                                            0.0s
 => => naming to localhost:5002/skeleton-poolcop-app:arm64                                                                                                                                                              0.0s
 *  Terminal will be reused by tasks, press any key to close it. 

Now, I list my images on my WSL2 Ubuntu 22.04:

flepron@LAPTOPFRANCOIS:~$ docker image ls -a
REPOSITORY                                   TAG       IMAGE ID       CREATED         SIZE
cross-toolchain-arm64-skeleton-poolcop-app   latest    e5492c62ed68   19 hours ago    740MB
localhost:5002/skeleton-poolcop-app          arm64     7df66a046383   20 hours ago    115MB
localhost:5002/test-cmake-debug              arm64     51ddc351a08b   2 weeks ago     228MB
localhost:5002/uart-csharp-debug             arm64     cd9b65047cd7   2 weeks ago     470MB
localhost:5002/test-console-csharp-8-debug   arm64     b66c30062fcc   2 weeks ago     470MB
alpine                                       latest    1d34ffeaf190   4 weeks ago     7.79MB
registry                                     2         d6b2c32a0f14   8 months ago    25.4MB
hello-world                                  latest    d2c94e258dcb   13 months ago   13.3kB
torizon/binfmt                               latest    893244d86992   3 years ago     37.5MB
flepron@LAPTOPFRANCOIS:~$

So, I see another image which has been created 20 hours ago with the name of the of my application. I do not understand why this image has not the timestamp of now, because I’ve just built the image.

Now, I run the pull the container in release mode using the task pull-container-torizon-release-arm64.

Here is the logs of this command:

 *  Executing task: DOCKER_HOST= docker compose build --pull --build-arg SSHUSERNAME=torizon --build-arg APP_ROOT=/home/torizon/app --build-arg IMAGE_ARCH=arm64 --build-arg GPU=-vivante skeleton-poolcop-app 

WARN[0000] The "LOCAL_REGISTRY" variable is not set. Defaulting to a blank string. 
WARN[0000] /home/flepron/dev/skeleton-poolcop-app/docker-compose.yml: `version` is obsolete 
[+] Building 0.9s (17/17) FINISHED                                                                                                                                                                            docker:default
 => [skeleton-poolcop-app internal] load build definition from Dockerfile                                                                                                                                               0.0s
 => => transferring dockerfile: 2.56kB                                                                                                                                                                                  0.0s
 => [skeleton-poolcop-app internal] load metadata for docker.io/torizon/debian:3.2.1-bookworm                                                                                                                           0.7s
 => [skeleton-poolcop-app internal] load metadata for docker.io/torizon/debian-cross-toolchain-arm64:3.2.1-bookworm                                                                                                     0.7s
 => [skeleton-poolcop-app internal] load .dockerignore                                                                                                                                                                  0.0s
 => => transferring context: 56B                                                                                                                                                                                        0.0s
 => [skeleton-poolcop-app build 1/7] FROM docker.io/torizon/debian-cross-toolchain-arm64:3.2.1-bookworm@sha256:e82fb5bd44dd76b65a2ce09e356036cac569384643e4535e3d546459377a8994                                         0.0s
 => [skeleton-poolcop-app internal] load build context                                                                                                                                                                  0.0s
 => => transferring context: 27.66kB                                                                                                                                                                                    0.0s
 => [skeleton-poolcop-app deploy 1/4] FROM docker.io/torizon/debian:3.2.1-bookworm@sha256:c645d6bc14f7d419340df0be25dbbe115ada029fa2e502a1c9149f335c59fc08                                                              0.0s
 => CACHED [skeleton-poolcop-app deploy 2/4] RUN apt-get -y update && apt-get install -y --no-install-recommends  && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*                                 0.0s
 => CACHED [skeleton-poolcop-app build 2/7] RUN apt-get -q -y update &&     apt-get -q -y install     cmake     procps     &&     apt-get clean && apt-get autoremove &&     rm -rf /var/lib/apt/lists/*                0.0s
 => CACHED [skeleton-poolcop-app build 3/7] COPY . /home/torizon/app                                                                                                                                                    0.0s
 => CACHED [skeleton-poolcop-app build 4/7] WORKDIR /home/torizon/app                                                                                                                                                   0.0s
 => CACHED [skeleton-poolcop-app build 5/7] RUN rm -rf /home/torizon/app/build-arm64                                                                                                                                    0.0s
 => CACHED [skeleton-poolcop-app build 6/7] RUN if [ "arm64" = "arm64" ] ; then         cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -Bbuild-a  0.0s
 => CACHED [skeleton-poolcop-app build 7/7] RUN cmake --build build-arm64                                                                                                                                               0.0s
 => CACHED [skeleton-poolcop-app deploy 3/4] COPY --from=Build /home/torizon/app/build-arm64/bin /home/torizon/app                                                                                                      0.0s
 => CACHED [skeleton-poolcop-app deploy 4/4] WORKDIR /home/torizon/app                                                                                                                                                  0.0s
 => [skeleton-poolcop-app] exporting to image                                                                                                                                                                           0.0s
 => => exporting layers                                                                                                                                                                                                 0.0s
 => => writing image sha256:7df66a04638341d8444ca33f3c028dacec400cddc65409ac0a4f5b7a8ce0ae59                                                                                                                            0.0s
 => => naming to localhost:5002/skeleton-poolcop-app:arm64                                                                                                                                                              0.0s
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: DOCKER_HOST= docker compose push skeleton-poolcop-app 

WARN[0000] The "LOCAL_REGISTRY" variable is not set. Defaulting to a blank string. 
WARN[0000] /home/flepron/dev/skeleton-poolcop-app/docker-compose.yml: `version` is obsolete 
[+] Pushing 13/0
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: 5f70bf18a086 Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: 3743c7b2d27f Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: 1b62cf9ee932 Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: 4d43de620b2b Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: 2b1b9a443581 Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: 78b4e0bbebbf Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: af2e04463901 Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: fa80bad6bfa4 Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: 99556bba1730 Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: 5eda8e9db600 Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: 9c76f5bd7f07 Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: 39940505a96f Layer already exists                                                                                                                                 0.0s 
 ✔ Pushing localhost:5002/skeleton-poolcop-app:arm64: f4e4d9391e13 Layer already exists                                                                                                                                 0.0s 
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: sshpass -p 959798 ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no torizon@192.168.10.111 DOCKER_LOGIN=192.168.10.112:5002 TAG=arm64 docker compose pull skeleton-poolcop-app 

Warning: Permanently added '192.168.10.111' (ED25519) to the list of known hosts.
time="2024-06-20T09:04:08Z" level=warning msg="The \"LOCAL_REGISTRY\" variable is not set. Defaulting to a blank string."
 skeleton-poolcop-app Pulling 
 2c6d21737d83 Already exists 
 fe3d200cde9c Already exists 
 721dc014b602 Already exists 
 b166b458b8a6 Already exists 
 6a1af1b6d795 Already exists 
 f17170ca9bf6 Already exists 
 3be06dfecdc9 Already exists 
 ca0693d0a393 Already exists 
 9c4d219b5f5f Already exists 
 4ea4fdc87dfe Already exists 
 48836db3eabb Pulling fs layer 
 ff2d95f9120e Pulling fs layer 
 4f4fb700ef54 Pulling fs layer 
 48836db3eabb Downloading [==================================================>]     366B/366B
 48836db3eabb Verifying Checksum 
 48836db3eabb Download complete 
 4f4fb700ef54 Downloading [==================================================>]      32B/32B
 ff2d95f9120e Downloading [=========>                                         ]  3.646kB/19.84kB
 4f4fb700ef54 Verifying Checksum 
 4f4fb700ef54 Download complete 
 ff2d95f9120e Downloading [==================================================>]  19.84kB/19.84kB
 48836db3eabb Extracting [==================================================>]     366B/366B
 ff2d95f9120e Verifying Checksum 
 ff2d95f9120e Download complete 
 48836db3eabb Extracting [==================================================>]     366B/366B
 48836db3eabb Pull complete 
 ff2d95f9120e Extracting [==================================================>]  19.84kB/19.84kB
 ff2d95f9120e Extracting [==================================================>]  19.84kB/19.84kB
 ff2d95f9120e Pull complete 
 4f4fb700ef54 Extracting [==================================================>]      32B/32B
 4f4fb700ef54 Extracting [==================================================>]      32B/32B
 4f4fb700ef54 Pull complete 
 skeleton-poolcop-app Pulled 
 *  Terminal will be reused by tasks, press any key to close it.  

Now, I list my docker images on my target device (SOM Verdin i.MX 8M Plus).

torizon@verdin-imx8mp-15229850:~$ docker image ls -a
REPOSITORY                                        TAG       IMAGE ID       CREATED        SIZE
192.168.10.112:5002/skeleton-poolcop-app          arm64     7df66a046383   21 hours ago   115MB
192.168.10.112:5002/test-cmake-debug              arm64     51ddc351a08b   2 weeks ago    228MB
192.168.10.112:5002/uart-csharp-debug             arm64     cd9b65047cd7   2 weeks ago    470MB
192.168.10.112:5002/test-console-csharp-8-debug   arm64     b66c30062fcc   2 weeks ago    470MB
nodered/node-red                                  3.1.3     12234ad916b0   5 months ago   564MB
torizon@verdin-imx8mp-15229850:~$

The date is always confusing : 21 hours ago for 192.168.10.112:5002/skeleton-poolcop-app !

I notice that my 192.168.10.112, is the IPv4 address of my Windows 11 Pro machine where my WSL2 Ubuntu 22.04 is installed. I do not know why because docker is installed on Ubuntu and not on my Windows machine.

After, I run interactively my docker image executing /bin/bash

torizon@verdin-imx8mp-15229850:~$ docker run -it --entrypoint /bin/bash 7df66a046383
root@373fa9ca2241:/home/torizon/app# ls -al
total 92
drwxr-xr-x 2 root    root     4096 Jun 19 12:15 .
drwxr-xr-x 1 torizon torizon  4096 Jun 19 12:15 ..
-rwxr-xr-x 1 root    root    83320 Jun 19 12:15 skeleton-poolcop-app
root@373fa9ca2241:/home/torizon/app# ps
bash: ps: command not found
root@373fa9ca2241:/home/torizon/app# top
bash: top: command not found
root@373fa9ca2241:/home/torizon/app# apt-get update
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 https://feeds.toradex.com/debian/snapshots/20231122T181708Z testing InRelease [15.1 kB]
Get:5 http://deb.debian.org/debian bookworm/main arm64 Packages [8685 kB]
Get:6 http://deb.debian.org/debian bookworm-updates/main arm64 Packages [13.7 kB]
Get:7 http://deb.debian.org/debian-security bookworm-security/main arm64 Packages [157 kB]
Get:8 https://feeds.toradex.com/debian/snapshots/20231122T181708Z testing/main arm64 Packages [59.7 kB]
Get:9 https://feeds.toradex.com/debian/snapshots/20231122T181708Z testing/non-free arm64 Packages [5271 B]
Fetched 9190 kB in 3s (2762 kB/s)
Reading package lists... Done
N: Repository 'Debian bookworm' changed its 'non-free component' value from 'non-free' to 'non-free non-free-firmware'
N: More information about this can be found online in the Release notes at: https://www.debian.org/releases/bookworm/arm64/release-notes/ch-information.html#non-free-split
root@373fa9ca2241:/home/torizon/app# apt-get install procps
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libncursesw6 libproc2-0
Recommended packages:
  libgpm2 psmisc
The following NEW packages will be installed:
  libncursesw6 libproc2-0 procps
0 upgraded, 3 newly installed, 0 to remove and 18 not upgraded.
Need to get 880 kB of archives.
After this operation, 3591 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main arm64 libncursesw6 arm64 6.4-4 [122 kB]
Get:2 http://deb.debian.org/debian bookworm/main arm64 libproc2-0 arm64 2:4.0.2-3 [60.1 kB]
Get:3 http://deb.debian.org/debian bookworm/main arm64 procps arm64 2:4.0.2-3 [698 kB]
Fetched 880 kB in 0s (6886 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libncursesw6:arm64.
(Reading database ... 6895 files and directories currently installed.)
Preparing to unpack .../libncursesw6_6.4-4_arm64.deb ...
Unpacking libncursesw6:arm64 (6.4-4) ...
Selecting previously unselected package libproc2-0:arm64.
Preparing to unpack .../libproc2-0_2%3a4.0.2-3_arm64.deb ...
Unpacking libproc2-0:arm64 (2:4.0.2-3) ...
Selecting previously unselected package procps.
Preparing to unpack .../procps_2%3a4.0.2-3_arm64.deb ...
Unpacking procps (2:4.0.2-3) ...
Setting up libproc2-0:arm64 (2:4.0.2-3) ...
Setting up libncursesw6:arm64 (6.4-4) ...
Setting up procps (2:4.0.2-3) ...
Processing triggers for libc-bin (2.36-9+deb12u3) ...
root@373fa9ca2241:/home/torizon/app# ps
    PID TTY          TIME CMD
      1 pts/0    00:00:00 bash
    213 pts/0    00:00:00 ps
root@373fa9ca2241:/home/torizon/app#

The thing I see, is that the package procps has not been installed at all in my docker image as specified in my Dockerfile.

# __deps__
RUN apt-get -q -y update && \
    apt-get -q -y install \
    cmake \
    procps \
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
    # __torizon_packages_dev_start__
    # __torizon_packages_dev_end__
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
    && \
    apt-get clean && apt-get autoremove && \
    rm -rf /var/lib/apt/lists/*
# __deps__

Could you please help me on this ?

Maybe, I do not follow the good steps to produce a release version containing needed packages.

Thank you for your assistance.

Sincerely,
François.

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello François,

It appears that the issue you’re encountering with the procps package not being installed in your Docker image stems from the multi-stage build process in your Dockerfile. Specifically, the installation of procps is performed in the build stage of your Dockerfile, but not in the final deploy stage where the application is actually run.

In a multi-stage Docker build, each FROM instruction starts a new stage, and by default, nothing from a previous stage is carried over to the next stage unless explicitly specified. In your Dockerfile, the procps package is installed in the build stage:

# BUILD ------------------------------------------------------------------------
FROM torizon/debian-cross-toolchain-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} As Build

...

RUN apt-get -q -y update && \
    apt-get -q -y install \
    cmake \
    procps \
...

However, this build stage is used for compiling your application, and the resulting binary is then copied over to the deploy stage. The deploy stage starts with a fresh image, and since procps is not installed in this stage, it’s not available when you run your container:

# DEPLOY -----------------------------------------------------------------------
FROM --platform=linux/${IMAGE_ARCH} torizon/debian:${BASE_VERSION} AS Deploy

...

To resolve this issue, you should install procps (and any other runtime dependencies your application may have) in the deploy stage of your Dockerfile. Here’s how you can modify the deploy stage to include the installation of procps:

# DEPLOY -----------------------------------------------------------------------
FROM --platform=linux/${IMAGE_ARCH} torizon/debian:${BASE_VERSION} AS Deploy

ARG IMAGE_ARCH
ARG APP_ROOT

RUN apt-get -y update && apt-get install -y --no-install-recommends \
    procps \
    && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*

# Copy the application compiled in the build step to the $APP_ROOT directory
# path inside the container, where $APP_ROOT is the torizon_app_root
# configuration defined in settings.json
COPY --from=Build ${APP_ROOT}/build-${IMAGE_ARCH}/bin ${APP_ROOT}

# "cd" (enter) into the APP_ROOT directory
WORKDIR ${APP_ROOT}

# Command executed in runtime when the container starts
CMD ["./skeleton-poolcop-app"]

This ensures that procps is available in

Please, also check if these links can help you solve your problem:

Torizon Sample: Image Classification with Tensorflow Lite | Toradex Developer Center.

Hi @ToradexAI

Thank you.

I understand your explanation and I know now where to place the packages I need in the image I will deploy on target devices. I was not aware about multi-stage Dockerfile. I have a basic knowledge in Docker.

You gave me the link Debian Containers for Torizon | Toradex Developer Center, but I do not understand the purpose and the differences of the following tasks in VS Code:

  • build-container-torizon-release-arm64
  • pull-container-torizon-release-arm64
  • push-container-torizon-release-arm64
  • deploy-torizon-arm64

I do not know which one creates the docker image release arm64 and which one pushes this image on the target device (Toradex Verdin i.MX 8M Plus).

Is there documentation on this topic or can you give me explanations these tasks, and maybe relevant other tasks defined in Torizon IDE Extension 2.5.1 ?

I wonder as well if Torizon IDE Extension uses a private local docker registry, because the verbs push and pull, usually push and pull an image to and from a docker registry.

If yes, how the docker registry is configured ? What is its IP address and port, as well as its login ?

Can you give me explanation on this please ?

Thank you.
François.

Greetings @flepron,

As the ToradexAI has explained, your initial issue with your packages not being installed in your final container is due to our use of multi-stage Docker builds. Just to explain the reason for why we do this. Very often when compiling an application it requires package dependencies and libraries to be built. But, these dependency packages are sometimes not required for the compiled application to then actually execute, they were only needed to build the application. This is why we do separate build stages like this. That way your final container image with your compiled application does not have a bunch of packages and libraries that were only needed for compilation. This results in a leaner more optimized final container image.

but I do not understand the purpose and the differences of the following tasks in VS Code:

All the tasks here for the project you can see their definition and what they do in the tasks.json file of your VSCode project. As a brief summary;

  • build-container-torizon-release-arm64
    • This builds and produces the release version of your application container image.
  • pull-container-torizon-release-arm64
    • This pulls the release version of your applcation container image onto your target device so the container image is available on that device.
  • push-container-torizon-release-arm64
    • This pushes your application container image to the container registry that you have configured in your project.
  • deploy-torizon-arm64
    • This is a composite task that executes several other tasks in sequence. Basically it builds pushes, pulls, and finally runs the debug version of your application container.

I do not know which one creates the docker image release arm64 and which one pushes this image on the target device (Toradex Verdin i.MX 8M Plus).

Given the above, build-container-torizon-release-arm64 creates your release image. While pull-container-torizon-release-arm64 pulls it onto your target device. Though keep in mind for it to be pulled onto your device it needs to first be pushed to a container registry somewhere via push-container-torizon-release-arm64. It’s like pushing your code to a git repository. It needs to be pushed somewhere, before it can be pulled somewhere else.

Is there documentation on this topic or can you give me explanations these tasks, and maybe relevant other tasks defined in Torizon IDE Extension 2.5.1 ?

As I said earlier you can see the definition of each tasks in your project’s tasks.json. It will show you exactly what each task is executing.

I wonder as well if Torizon IDE Extension uses a private local docker registry, because the verbs push and pull, usually push and pull an image to and from a docker registry.

When running the debug variant of your container, the extension will setup a temporary local registry on your development machine where VSCode is running. This is just for development purposes as a temporary registry to push and pull your container image from while you’re still developing.

With the release variant of your container image it’s expected that this will be pushed to an actual proper container registry, like Dockerhub or such. You can configure where it ends up getting pushed but the default is Dockerhub I believe.

If yes, how the docker registry is configured ? What is its IP address and port, as well as its login ?

This is also a task you can view run-docker-registry. It just runs the registry container image provided by Docker that can act as a interim container registry. It uses port 5002 and your development machine IP address. That is why in your initial post you saw that the device was pulling 192.168.10.112:5002/skeleton-poolcop-app. It’s accessing your development machine on port 5002 where the local registry is serving. This is a completely insecure registry therefore there is no login or authentication. This is fine though, as I said this is only for the debug variant of your container image and is intended for development purposes only. For your release container image please use a proper container registry that you can control and manage.

I hope this helps clear things up.

Best Regards,
Jeremias

1 Like

Hi @jeremias.tx

Your explanations are excellent and really helpful.

I should have read page like this one : Build, Test and Push Applications for Production, but sometimes it is complex (exhausting and tough) to find the relevant documentations to the question I have. I must be too old or weak :face_with_head_bandage: :face_with_hand_over_mouth: :face_with_peeking_eye:

I saw that when I hover my mouse pointer over a task, there is a hint that explains the purpose of the task.

I have a suggestion for the next release of VS Code Torizon IDE extension of @matheus.tx.

Maybe you can add more explanations or an URL link onto the matching page on developer.toradex.com which explains in detail the task, and the proper way to use it, and the correct workflow.

This is just a suggestion. This might not be valuable for other developers of the Toradex’s community, so forget my idea.

Your Torizon IDE extension is already one of the best on the market of embedding development, believe me.

I thank you very much @jeremias.tx for your kind and efficient assistance, and also if you can tell to the Toradex’s Support Team that @ToradexAI is already an awesome first support door. I really appreciate it. It gives relevant information. :+1:t4: :100: :clap:t4:

I would be really happy that my company do the same for our products support.

You can close this topic since you have answered to my questions as I expected.

Many thanks again. :pray:t4:

Sincerely,
François.

Glad I was able to assist.