Torizon IDE extenstion, run-container-torizon-release-arm64 task fails

I currently have a project setup using a linux (ubuntu) virtual machine in combination with a Verdin AM62 module and this has been working correctly for several months now (i can debug just fine).

I want to setup the AM62 module in such a way that it boots my application at startup and i think i need a release version for that, please correct me if i am wrong about this.

I want to build release version of the project using the Visual Studio Torizon IDE extension tasks but i can’t figure out why this does not work.

According to the documentation (“Build, Test and Push Applications for Production | Toradex Developer Center”) i can generate a release version using the ‘run-container-torizon-release-arm64’ task, this however fails in a resulting error code 17.

output of task:

 *  Executing task: pwsh -nop .conf/validateDepsRunning.ps1 


⚠️ VALIDATING ENVIRONMENT


✅ Environment is valid!

 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: bash -c [[ ! -z "10.194.154.65" ]] && true || false 

 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: bash -c [[ "aarch64" == "aarch64" ]] && true || false 

 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: sleep 1 

 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: sshpass -p test scp -P 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /home/richard/GatewayUnitApplication/docker-compose.yml torizon@10.194.154.65:~/ 

Warning: Permanently added '10.194.154.65' (ED25519) to the list of known hosts.
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: DOCKER_HOST=10.194.154.65:2375 docker image prune -f --filter=dangling=true 

Total reclaimed space: 0B
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: docker compose -p torizon stop gateway_unit_application gateway_unit_application-debug && docker compose -p torizon rm -f gateway_unit_application gateway_unit_application-debug 

No stopped containers
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: pwsh -nop /home/richard/GatewayUnitApplication/.conf/torizonPackages.ps1 arm64 

Applying torizonPackages.json ...
Applying to Dockerfile.debug ...
✅ Dockerfile.debug
Applying to Dockerfile ...
✅ Dockerfile
torizonPackages.json applied
 *  Terminal will be reused by tasks, press any key to close it. 

 *  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= gateway_unit_application 

WARN[0000] /home/richard/GatewayUnitApplication/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
WARN[0000] The "LOCAL_REGISTRY" variable is not set. Defaulting to a blank string. 
[+] Building 0.0s (0/0)                                                                                  docker:default
invalid tag "localhost:5002/:gateway_unit_applicationarm64": invalid reference format

 *  The terminal process "/usr/bin/bash '-c', '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= gateway_unit_application'" failed to launch (exit code: 17). 
 *  Terminal will be reused by tasks, press any key to close it. 

configuration of ‘tasks.json’ “build-container-torizon-release-arm64”

        {
            "label": "build-container-torizon-release-arm64",
            "detail": "",
            "hide": true,
            "command": "DOCKER_HOST=",
            "type": "shell",
            "options": {
                "env": {
                    "DOCKER_LOGIN": "localhost:5002",
                    "TAG": "arm64",
                    "GPU": "${config:torizon_gpu}",
                    "DEBUG_SSH_PORT": "${config:torizon_debug_ssh_port}",
                    "DEBUG_PORT1": "${config:torizon_debug_port1}",
                    "DEBUG_PORT2": "${config:torizon_debug_port2}",
                    "DEBUG_PORT3": "${config:torizon_debug_port3}"
                }
            },
            "args": [
                "docker",
                "compose",
                "build",
                "--pull",
                "--build-arg",
                "SSHUSERNAME=${config:torizon_run_as}",
                "--build-arg",
                "APP_ROOT=${config:torizon_app_root}",
                "--build-arg",
                "IMAGE_ARCH=arm64",
                "--build-arg",
                "GPU=${config:torizon_gpu}",
                "gateway_unit_application"
            ],
            "dependsOrder": "sequence",
            "dependsOn": [
                "apply-torizon-packages-arm64"
            ],
            "problemMatcher": "$msCompile",
            "icon": {
                "id": "tools",
                "color": "terminal.ansiYellow"
            },
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": true,
                "panel": "shared",
                "group": "build-execution"
            }
        },

Kind regards,
Richard.

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello Richard,

Thank you for reaching out with your question. It seems you’re encountering an issue with building a release version of your application using the Visual Studio Torizon IDE extension. Let’s go through some steps to help resolve this.

  1. Check the Image Tag Format: The error message you received suggests an invalid tag format. Ensure your image tag is correctly formatted without a trailing slash. It should be something like localhost:5002/gateway_unit_application:arm64. Please adjust your tasks.json or Docker configuration to reflect this format.

  2. Set the LOCAL_REGISTRY Variable: The warning about the unset LOCAL_REGISTRY variable indicates that this environment variable is expected during the build process. You should define this variable in your environment settings, possibly as localhost:5002, to match your local registry setup.

  3. Update docker-compose.yml: The warning regarding the obsolete version attribute in your docker-compose.yml file suggests that this attribute is no longer necessary. Removing it can help prevent any potential confusion or issues during the build process.

  4. Review DOCKER_HOST Configuration: The DOCKER_HOST variable is currently set to an empty string in your task configuration. If you are not using a specific Docker host, you can remove this setting. Otherwise, ensure it points to a valid Docker host address.

By addressing these points, you should be able to resolve the build failure and successfully create a release version of your application. This will enable your application to boot automatically on the Verdin AM62 module as you intended.

I hope this helps! If you have any more questions, feel free to ask.

Best regards,
Toradex AI Assistant

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

Problems setting up VS Code IDE Extension V2.

Update, i had an invalid setting in the docker compose file for " image: ${DOCKER_LOGIN}/:gateway_unit_application:${TAG}" >> forgot to add the “:” character before the ${TAG} bud sadly it did not fix the issue.

Update, i had an invalid setting in the docker compose file for " image: ${DOCKER_LOGIN}/:gateway_unit_application:${TAG}" >> forgot to add the “:” character before the ${TAG} bud sadly it did not fix the issue.

After you fixed this, what are you seeing now for the issue in the logs? Is it still an issue with your compose file, or something else now?

Best Regards,
Jeremias

Hi Jeremias,

I made some modifications to my projects docker-compose.yml file and now the build, push and pull steps seem to go correctly but the final run step of the task currently fails.

I modified the docker-compose.yml file to the following (changed the image location from "${DOCKER_LOGIN}/: " to “${LOCAL_REGISTRY}:5002/”, same as the debug version)

docker-compose.yml file:

services:
  gateway_unit_application-debug:
    build:
      context: .
      dockerfile: Dockerfile.debug
    image: ${LOCAL_REGISTRY}:5002/gateway_unit_application-debug:${TAG}
    ports:
      - ${DEBUG_SSH_PORT}:${DEBUG_SSH_PORT}
      - ${DEBUG_PORT1}:${DEBUG_PORT1}
      - "8883:8883"
    volumes:
      - gateway_application:/var/lib/docker/volumes/torizon_gateway_application/_data
      #ADC
      - "adc1:/var/lib/docker/volumes/torizon_adc1/_data" 
        # module serialnumber
      - "serial:/var/lib/docker/volumes/torizon_serial/_data"
    devices:
    # UART
    # ttyS0 = UART 1 (Expansion slot 1)
    # ttyS1 = WKUP UART (Junction box 1)
    # ttyS2 = UART 0 (Linux console output)
    # ttyS3 = MCU UART (Junction box 2)
    # ttyS4 = UART 5 (debug interface)
    # ttyS5 = UART 3 (Expansion slot 2)
    - "/dev/ttyS0:/dev/ttyS0"
    - "/dev/ttyS1:/dev/ttyS1"
    - "/dev/ttyS3:/dev/ttyS3"
    - "/dev/ttyS4:/dev/ttyS4"
    - "/dev/ttyS5:/dev/ttyS5"
    #I2C
    - "/dev/verdin-i2c1:/dev/verdin-i2c1"
    - "/dev/verdin-i2c2:/dev/verdin-i2c2"
    - "/dev/verdin-i2c3:/dev/verdin-i2c3"
    #GPIO
    - "/dev/gpiochip0:/dev/gpiochip0"
    - "/dev/gpiochip1:/dev/gpiochip1"
    - "/dev/gpiochip2:/dev/gpiochip2"

  gateway_unit_application:
    build:
      context: .
      dockerfile: Dockerfile
    image: ${LOCAL_REGISTRY}:5002/gateway_unit_application:${TAG}
    volumes:
    - gateway_application:/var/lib/docker/volumes/torizon_gateway_application/_data
    #ADC
    - "adc1:/var/lib/docker/volumes/torizon_adc1/_data" 
    # module serialnumber
    - "serial:/var/lib/docker/volumes/torizon_serial/_data"
    devices:
    # UART
    # ttyS0 = UART 1 (Expansion slot 1)
    # ttyS1 = WKUP UART (Junction box 1)
    # ttyS2 = UART 0 (Linux console output)
    # ttyS3 = MCU UART (Junction box 2)
    # ttyS4 = UART 5 (debug interface)
    # ttyS5 = UART 3 (Expansion slot 2)
    - "/dev/ttyS0:/dev/ttyS0"
    - "/dev/ttyS1:/dev/ttyS1"
    - "/dev/ttyS3:/dev/ttyS3"
    - "/dev/ttyS4:/dev/ttyS4"
    - "/dev/ttyS5:/dev/ttyS5"
    #I2C
    - "/dev/verdin-i2c1:/dev/verdin-i2c1"
    - "/dev/verdin-i2c2:/dev/verdin-i2c2"
    - "/dev/verdin-i2c3:/dev/verdin-i2c3"
    #GPIO
    - "/dev/gpiochip0:/dev/gpiochip0"
    - "/dev/gpiochip1:/dev/gpiochip1"
    - "/dev/gpiochip2:/dev/gpiochip2"

volumes:
  gateway_application:
    driver: local # Define the driver and options under the volume name
    driver_opts:
      type: none
      device: /home/torizon/gateway_application
      o: bind
  adc1:
    driver: local # Define the driver and options under the volume name
    driver_opts:
      type: none
      device: /sys/devices/platform/bus@f0000/20000000.i2c/i2c-0/0-0049/iio:device0
      o: bind
  serial:
    driver: local # Module location for readable serial number
    driver_opts:
      type: none
      device: /proc/device-tree
      o: bind

Task output:

 *  Executing task: pwsh -nop .conf/validateDepsRunning.ps1 


⚠️ VALIDATING ENVIRONMENT


✅ Environment is valid!

 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: bash -c [[ ! -z "10.194.154.65" ]] && true || false 

 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: bash -c [[ "aarch64" == "aarch64" ]] && true || false 

 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: sleep 1 

 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: sshpass -p test scp -P 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /home/richard/GatewayUnitApplication/docker-compose.yml torizon@10.194.154.65:~/ 

Warning: Permanently added '10.194.154.65' (ED25519) to the list of known hosts.
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: DOCKER_HOST=10.194.154.65:2375 docker image prune -f --filter=dangling=true 

Total reclaimed space: 0B
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: docker compose -p torizon stop gateway_unit_application gateway_unit_application-debug && docker compose -p torizon rm -f gateway_unit_application gateway_unit_application-debug 

No stopped containers
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: pwsh -nop /home/richard/GatewayUnitApplication/.conf/torizonPackages.ps1 arm64 

Applying torizonPackages.json ...
Applying to Dockerfile.debug ...
✅ Dockerfile.debug
Applying to Dockerfile ...
✅ Dockerfile
torizonPackages.json applied
 *  Terminal will be reused by tasks, press any key to close it. 

 *  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= gateway_unit_application 

[+] Building 1.0s (21/21) FINISHED                                             docker:default
 => [gateway_unit_application internal] load build definition from Dockerfile            0.0s
 => => transferring dockerfile: 2.13kB                                                   0.0s
 => [gateway_unit_application internal] load metadata for docker.io/commontorizon/debia  0.9s
 => [gateway_unit_application internal] load .dockerignore                               0.0s
 => => transferring context: 117B                                                        0.0s
 => [gateway_unit_application  1/15] FROM docker.io/commontorizon/debian:3.3.1-bookworm  0.0s
 => [gateway_unit_application internal] load build context                               0.0s
 => => transferring context: 10.68kB                                                     0.0s
 => CACHED [gateway_unit_application  2/15] RUN apt-get -q -y update &&     apt-get -q   0.0s
 => CACHED [gateway_unit_application  3/15] RUN python3 -m venv /home/torizon/app/.venv  0.0s
 => CACHED [gateway_unit_application  4/15] COPY requirements-release.txt /requirements  0.0s
 => CACHED [gateway_unit_application  5/15] RUN . /home/torizon/app/.venv/bin/activate   0.0s
 => CACHED [gateway_unit_application  6/15] COPY ./src /home/torizon/app/src             0.0s
 => CACHED [gateway_unit_application  7/15] COPY device_certificate.txt /home/torizon/a  0.0s
 => CACHED [gateway_unit_application  8/15] COPY device_private_key.txt /home/torizon/a  0.0s
 => CACHED [gateway_unit_application  9/15] COPY root_certificate.txt /home/torizon/app  0.0s
 => CACHED [gateway_unit_application 10/15] RUN chmod 777 /home/torizon/app/device_cert  0.0s
 => CACHED [gateway_unit_application 11/15] RUN chmod 777 /home/torizon/app/device_priv  0.0s
 => CACHED [gateway_unit_application 12/15] RUN chmod 777 /home/torizon/app/root_certif  0.0s
 => CACHED [gateway_unit_application 13/15] WORKDIR /home/torizon/app                    0.0s
 => CACHED [gateway_unit_application 14/15] RUN usermod -a -G gpio torizon               0.0s
 => CACHED [gateway_unit_application 15/15] RUN mkdir /home/torizon/app/log && chown -R  0.0s
 => [gateway_unit_application] exporting to image                                        0.0s
 => => exporting layers                                                                  0.0s
 => => writing image sha256:942b6b1ca7d9dca31fb616508f6114235708bdd7cf2792309be5e19ac1f  0.0s
 => => naming to localhost:5002/gateway_unit_application:arm64                           0.0s
 => [gateway_unit_application] resolving provenance for metadata file                    0.0s
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: DOCKER_HOST= docker compose push gateway_unit_application 

[+] Pushing 25/0
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: e028df87cb40 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: 0ed66982698d Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: 5f70bf18a086 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: 2ca8bb09c91e Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: d761991230b5 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: 1bc09d166127 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: bf52c7d5bd8b Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: f0f9eaad5ccc Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: fd4a71f09b12 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: c489216653f7 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: c7131f3a9354 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: a475b8407a96 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: f5f8404c502f Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: fd6308ece195 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: bb95280742bd Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: d5661228a6f6 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: 1f74cca9ef3c Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: cf08845a6a01 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: e009595c7dc0 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: 6dc89911362e Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: 0d7dccc6d0e7 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: 67ca54a26679 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: 3440d23a444f Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: 5a49bdb65752 Layer already exists 0.0s 
 ✔ Pushing localhost:5002/gateway_unit_application:arm64: 2bd1a2222589 Layer already exists 0.0s 
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: DOCKER_HOST=10.194.154.65:2375 LOCAL_REGISTRY=10.194.154.52 DOCKER_LOGIN=10.194.154.52:5002 TAG=arm64 GPU= DEBUG_SSH_PORT=6503 DEBUG_PORT1=6513 DEBUG_PORT2= DEBUG_PORT3= docker compose pull gateway_unit_application 

[+] Pulling 1/1
 ✔ gateway_unit_application Pulled                                                       0.3s 
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: DOCKER_HOST=10.194.154.65:2375 DOCKER_LOGIN=10.194.154.52:5002 TAG=arm64 GPU= DEBUG_SSH_PORT=6503 DEBUG_PORT1=6513 DEBUG_PORT2= DEBUG_PORT3= docker compose -p torizon up gateway_unit_application 

WARN[0000] The "LOCAL_REGISTRY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "LOCAL_REGISTRY" variable is not set. Defaulting to a blank string. 
unable to get image ':5002/gateway_unit_application:arm64': Error response from daemon: no such image: :5002/gateway_unit_application:arm64: invalid reference format

 *  The terminal process "/usr/bin/bash '-c', 'DOCKER_HOST=10.194.154.65:2375 DOCKER_LOGIN=10.194.154.52:5002 TAG=arm64 GPU= DEBUG_SSH_PORT=6503 DEBUG_PORT1=6513 DEBUG_PORT2= DEBUG_PORT3= docker compose -p torizon up gateway_unit_application'" failed to launch (exit code: 1). 
 *  Terminal will be reused by tasks, press any key to close it. 

This is my first experience using docker and it is going pretty roughly :stuck_out_tongue:

Looking at your task output logs the issue is fairly apparent:

WARN[0000] The "LOCAL_REGISTRY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "LOCAL_REGISTRY" variable is not set. Defaulting to a blank string. 
unable to get image ':5002/gateway_unit_application:arm64': Error response from daemon: no such image: :5002/gateway_unit_application:arm64: invalid reference format

It’s saying that LOCAL_REGISTRY isn’t set in the task execution. This causes issues because if you look at your compose file the container image is referenced as ${LOCAL_REGISTRY}:5002/gateway_unit_application-debug:${TAG}. If LOCAL_REGISTRY is not set then this obviously wouldn’t work.

Looking at the specific task that failed:

Executing task: DOCKER_HOST=10.194.154.65:2375 DOCKER_LOGIN=10.194.154.52:5002 TAG=arm64 GPU= DEBUG_SSH_PORT=6503 DEBUG_PORT1=6513 DEBUG_PORT2= DEBUG_PORT3= docker compose -p torizon up gateway_unit_application 

I can see that it’s true LOCAL_REGISTRY is not set in this task execution. Did you modify the tasks in your project as well? By default the task sets LOCAL_REGISTRY, so something in your project has changed this behavior.

Oh wait, this is the release task not the debug task no? Then you need to add the LOCAL_REGISTRY variable to this task.

Best Regards,
Jeremias

Hi Jeremias,

Thank you for the response, it is indeed the release task that is failing, the debugging works fine.

Ok, so i just needed to add the LOCAL_REGISTRY to the release task.json file?

I am not quite sure what the LOCAL_REGISTRY means, can you explain it real quick, and is there a reason this is setup for debugging but not for release tasks?

Ok, so i just needed to add the LOCAL_REGISTRY to the release task.json file?

More or less yes.

I am not quite sure what the LOCAL_REGISTRY means, can you explain it real quick, and is there a reason this is setup for debugging but not for release tasks?

I mean just look at how you’ve defined your image in the compose file:

${LOCAL_REGISTRY}:5002/gateway_unit_application:${TAG}}

You’re saying that this image can be found at ${LOCAL_REGISTRY}:5002. This should correspond to a local container registry that is running on the same machine you have VSCode running. Just look at the previous task in your logs before the failure:

Executing task: DOCKER_HOST=10.194.154.65:2375 LOCAL_REGISTRY=10.194.154.52 DOCKER_LOGIN=10.194.154.52:5002 TAG=arm64 GPU= DEBUG_SSH_PORT=6503 DEBUG_PORT1=6513 DEBUG_PORT2= DEBUG_PORT3= docker compose pull gateway_unit_application 

Notice how local registry is defined?

The reason this isn’t used in release, is because it makes no sense in most cases. If your device is in production then it should be able to access the container image. If your container image is hosted on a local registry running on your development PC away from the device in the field, then that doesn’t really work in many production scenarios. That’s why the release task assumes you’ve pushed your container image already to some publicly accessible container registry like Dockerhub. For debugging/development it’s quicker/easier to have the container image just hosted in the local registry on your development machine for quicker iterations.

Did you push your release container image to ${LOCAL_REGISTRY}:5002/gateway_unit_application:${TAG}? And if yes, why?

Best Regards,
Jeremias

Hi Jeremias,

I got it working after some fumbling around and trial and error.
The main reason this issue arose for me was the inexperience with Docker and i did not have a production server yet so it was not pushed anywhere.
I got it working for now so this issue can be closed, final reason: i am a docker newb.

Good to hear you got this resolved.

Best Regards,
Jeremias