Torizoncore-builder inside Azure pipelines

Latest version of tcbuilder works fine on native linux (ubuntu 22.04)
but same OS inside azure pipelines, This error pops up:

torizoncore-builder --log-level DEBUG bundle --platform=linux/64/v8 docker-compose.yml --bundle-directory bundle
When I try to run the bundle command normally, the tcbuilder can’t see the docker-compose.yml in the same folder…

And when I try the full path, the error (see photo) pops up
torizoncore-builder --log-level DEBUG bundle --platform=linux/64/v8 $(pwd)/docker-compose.yml --bundle-directory bundle

Perhaps there’s something basic I am overlooking but it looks like the tcbuilder container has an issue.

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Looking at your issue with TorizonCore Builder in Azure Pipelines, there are several potential causes and solutions to explore:

Platform Specification Issue

First, there’s an issue with your platform specification. The correct platform for 64-bit ARM should be linux/arm64, not linux/64/v8 (1). Try this command instead:

torizoncore-builder --log-level DEBUG bundle --platform=linux/arm64 docker-compose.yml --bundle-directory bundle

File Path and Working Directory

TorizonCore Builder has specific requirements about file paths (2). The tool can only access files within the current working directory, and relative paths are interpreted relative to the working directory of torizoncore-builder (2).

When using absolute paths with $(pwd), you’re specifying paths from the perspective of the container, which can introduce confusion or unexpected lookup issues (2). The documentation specifically states that “the use of absolute paths in the configuration file is generally discouraged” (2).

Azure Pipelines Specific Issues

Based on similar issues reported in the community, Azure environments can have Docker-in-Docker (DinD) connectivity problems (3). The error you’re experiencing might be related to the Docker daemon connection that TorizonCore Builder uses internally.

Troubleshooting Steps

  1. Verify your working directory setup: Ensure your docker-compose.yml file is in the same directory where you’re running TorizonCore Builder
  2. Use relative paths: Instead of $(pwd)/docker-compose.yml, simply use docker-compose.yml
  3. Check Docker daemon: Verify that Docker is properly running in your Azure Pipeline environment
  4. Platform correction: Use the correct platform specification linux/arm64 for 64-bit ARM or linux/arm/v7 for 32-bit ARM (4)

Alternative Approach

If the bundle command continues to fail, you might consider using the build command with a configuration file instead, which can handle the bundling process internally (5):

output:
  easy-installer:
    local: <path>
    bundle:
      compose-file: docker-compose.yml

This approach downloads container images during the build process and might work better in CI/CD environments (5).

Best regards,
Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hello Jippe,

Thanks for the details and the logs.
From the message:

Your current working directory is: /azp/_work/3/s/torizon-core-builder

TorizonCore Builder can only see files inside this working directory as it is mounted into the container. Host‑absolute paths like $(pwd)/docker-compose.yml often don’t exist from inside the container, even if they work on a native Ubuntu shell.
To avoid this, please:

Make sure you’re in the directory that actually contains docker-compose.yml in your pipeline step:

cd /azp/_work/3/s/torizon-core-builder   # adjust if neededls -l docker-compose.yml                 # confirm it’s here

Call bundle using a relative path, not an absolute one:

torizoncore-builder --log-level DEBUG \  bundle docker-compose.yml \  --platform=linux/arm64/v8 \  --bundle-directory bundle

If the compose file is in a subdirectory, use that relative path instead, for example:

torizoncore-builder bundle subdir/docker-compose.yml --bundle-directory bundle

If it still cannot find the file, could you share:

  • the pwd right before running the command, and
  • the output of: find . -maxdepth 3 -type f -name 'docker-compose.yml'
    so we can see how the paths look inside your Azure pipeline workspace?

Best Regards,

Diego Maia
Toradex

Hello Jippe,

Thanks for the details and the logs.
From the message:

Your current working directory is: /azp/_work/3/s/torizon-core-builder

TorizonCore Builder can only see files inside this working directory as it is mounted into the container. Host‑absolute paths like $(pwd)/docker-compose.yml often don’t exist from inside the container, even if they work on a native Ubuntu shell.
To avoid this, please:

Make sure you’re in the directory that actually contains docker-compose.yml in your pipeline step:

cd /azp/_work/3/s/torizon-core-builder   # adjust if neededls -l docker-compose.yml                 # confirm it’s here

Call bundle using a relative path, not an absolute one:

torizoncore-builder --log-level DEBUG \  bundle docker-compose.yml \  --platform=linux/arm64/v8 \  --bundle-directory bundle

If the compose file is in a subdirectory, use that relative path instead, for example:

torizoncore-builder bundle subdir/docker-compose.yml --bundle-directory bundle

If it still cannot find the file, could you share:

the pwd right before running the command, and
the output of: find . -maxdepth 3 -type f -name 'docker-compose.yml'
so we can see how the paths look inside your Azure pipeline workspace?

Best Regards,

Diego Maia
Toradex

Hi Diego!

Thanks for reaching out. Here’s the exact commands I used before, with relative path!

pwd
ls -la .
chown -R 1000:1000 .
torizoncore-builder bundle --platform=linux/arm64/v8 docker-compose.yml --bundle-directory bundle


The pipeline then outputs exactly what I expect:

/azp/_work/3/s/torizon-core-builder
total 257792
drwxr-xr-x  2 azpuser azpuser      4096 Mar 12 19:33 .
drwxr-xr-x 12 azpuser azpuser      4096 Mar 12 19:33 ..
-rw-r--r--  1 azpuser azpuser       249 Mar 12 19:33 docker-compose.yml
-rwxr-xr-x  1 azpuser azpuser     11697 Mar 12 19:33 tcb-env-setup.sh
-rw-r--r--  1 azpuser azpuser       317 Mar 12 19:33 tcbuild.yaml
-rw-r--r--  1 azpuser azpuser 263946240 Mar 12 19:33 torizon-docker-artifact.tar
Creating Docker Container bundle...
Error: File does not exist: docker-compose.yml. Aborting.

Could the tcb not finding my compose file, be related to the -d flag in

source tcb-env-setup.sh -a remote -n -d

Hi @jippeheijnen,

I would not expect absolute paths to work in this case, since TCB is a container mounting the directory from where it was sourced as its work directory. This means that it would make sense to source TCB in the directory where the files and directories are located, required by TCB and use the relative path.

A coworker of mine has just tried this out himself with the same arguments for TCB as you, which resulted in success.

[  9:16AM ]  [ ~/xablau.w0w ]
 $ source ~/Toradex/torizoncore-builder/tcb-env-setup/tcb-env-setup.sh -a remote -n -d
WARNING: This output is designed for human readability. For machine-readable output, please use --format.
Setting up TorizonCore Builder with version 3.

Pulling TorizonCore Builder...
3: Pulling from torizon/torizoncore-builder
Digest: sha256:b9c854de01337c597473189a99b5c6e983fbc431a85a6a0a6414d1cbd34d3794
Status: Image is up to date for torizon/torizoncore-builder:3
docker.io/torizon/torizoncore-builder:3
Done!

/home/grilo/Toradex/torizoncore-builder/tcb-env-setup/tcb-env-setup.sh:export:294: invalid option(s)
Setup complete! TorizonCore Builder is now ready to use.
TorizonCore Builder internal status and image customizations will be stored in Docker volume named 'storage'.
********************
Important: When you run TorizonCore Builder, the tool can only access the files inside the current working directory. Files and directories outside of the current working directory, or links to files and directories outside of the current working directory, won't be visible to TorizonCore Builder. So please make sure that, when running TorizonCore Builder, all files and directories passed as parameters are within the current working directory.
Your current working directory is: /home/grilo/xablau.w0w
********************
For more information, run 'torizoncore-builder -h' or go to https://developer.toradex.com/knowledge-base/torizoncore-builder-tool
[  9:17AM ]  [ ~/xablau.w0w ]  [ 130 ]
 $ cat <<EOF > docker-compose.yml
services:
  hello-world:
    image: hello-world
EOF
[  9:17AM ]  [ ~/xablau.w0w ]
 $ bat docker-compose.yml
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: docker-compose.yml
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ services:
   2   │   hello-world:
   3   │     image: hello-world
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────
[  9:17AM ]  [ ~/xablau.w0w ]
 $ torizoncore-builder bundle --platform=linux/arm64/v8 docker-compose.yml --bundle-directory bundle
Creating Docker Container bundle...
NOTE: TCB no longer expands environment variables present in the compose file.

Starting DIND container
Connecting to Docker Daemon at "tcp://172.17.0.3:22376"
Fetching container image hello-world in service hello-world
  Pulling from library/hello-world
  198f93fd5094: Pull complete
  Digest: sha256:85404b3c53951c3ff5d40de0972b1bb21fafa2e8daa235355baf44f33db9dbdd
  Status: Downloaded newer image for hello-world:latest
Saving Docker Compose file
Exporting storage
Storing container bundle into "bundle"
Stopping DIND container
Successfully created Docker Container bundle in "bundle"!

What is the current status on your end?

Best regards,
Collin

Hi @collin.tx ,

Thank you Colin (and your colleague) for taking the time for looking into this. Crucial difference howver, is that my tcb runs inside an azure pipeline (inside an azure agent). I suppose this throws a spanner in the works.

Please let me know if you can replicate this or if you have known limitations with azure pipelines/agents.

Thanks in advance!
Jippe

Hi @jippeheijnen,

The primary thing I can suggest is for us to figure out the directory TCB is being executed from, and the directory your docker-compose file is in the pipeline.

As an additional debugging step you could try the following step:

docker run --rm -it  -v /deploy -v "$(pwd)":/workdir -v storage:/storage -v /var/run/docker.sock:/var/run/docker.sock $(tcb_dynamic_params)  --entrypoint="ls" torizon/torizoncore-builder:3

This changes the entrypoint of the TCB container to ls which should show what the TCB container can “see” in its working directory. This could help confirm and narrow down what TCB can and can’t see in this customer’s Azure pipeline.

Alternatively you could change the bind-mount on the TCB container from -v "$(pwd)":/workdir to -v <path to my directory containing docker-compose file>:/workdir.
That is if you know what this path is in your pipeline.

Best regards,
Collin

Hi @collin.tx,

Thanks for you patience I finally got round to testing the pipeline, and I tried your suggestion.

I modified it however, since the -it flag does not work with the ‘ls’ entrypoint.

pwd
ls -la .
chown -R 1000:1000 ./
# above steps are still the pipeline

#this is the modified tcb command.
docker run --rm \
  -v "$(pwd)":/workdir \
  -v storage:/storage \
  --entrypoint sh \
  torizon/torizoncore-builder:3 -lc '
    set -eux
    echo "PWD in container: $(pwd)"
    ls -la /workdir
    ls -la /storage || true
    test -f /workdir/tcbuild.yaml && echo "tcbuild.yaml exists"
  '

This pipeline snippet resulted in this pipeline output:

/azp/_work/9/s/torizon-core-builder
total 28
drwxr-xr-x 2 azpuser azpuser  4096 Apr 13 08:17 .
drwxr-xr-x 7 azpuser azpuser  4096 Apr 13 08:17 ..
-rw-r--r-- 1 azpuser azpuser   299 Apr 13 08:17 docker-compose.yml
-rwxr-xr-x 1 azpuser azpuser 11697 Apr 13 08:17 tcb-env-setup.sh
-rw-r--r-- 1 azpuser azpuser   327 Apr 13 08:17 tcbuild.yaml
++ pwd
PWD in container: /workdir
+ echo 'PWD in container: /workdir'
+ ls -la /workdir
total 8
drwxr-xr-x 2 root root 4096 Apr 13 06:54 .
drwxr-xr-x 1 root root 4096 Apr 13 08:18 ..
+ ls -la /storage
total 8
drwxr-xr-x 2 root root 4096 Jan 12 10:24 .
drwxr-xr-x 1 root root 4096 Apr 13 08:18 ..
+ test -f /workdir/tcbuild.yaml

##[error]Bash exited with code '1'.

So I suppose that something is going wrong with the volumes…