Torizon builder and docker compose files

I’m following your doc for the generation of a complete image of our solution (Pre-provisioning Docker Containers onto a Torizon OS image). My docker-compose.yml file contains files which need to be added. E.g. :

mosquitto:
    image: eclipse-mosquitto:2.0
    restart: always
    ports:
      - "1883:1883"
      - "9001:9001"
    volumes:
      - type: bind
        source: mqtt/mosquitto.conf
        target: /mosquitto/config/mosquitto.conf
      - type: bind
        source: scripts/
        target: /scripts
    networks: 
      - hygie

But I don’t see my custom files (e.g. mosquitto.conf) in my system after installation.
If I do the docker compose directly on the Toradex board there is no problem.

This is how I created the bundle:

hygie-os/hygie-deploy$ torizoncore-builder bundle docker-compose.yml --bundle-directory bundle

and how I built the image:
hygie-os$ torizoncore-builder build
with the tcbuild.yaml file:

output:
  easy-installer:
    local: images/torizon-core-docker-colibri-imx8x-hygie_2.CUSTOM
    bundle:
      dir: hygie-deploy/bundle/

Forgot to mention that the file is here:

hygie-os/hygie-deploy$ ls mqtt/
mosquitto.conf

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,

To ensure your custom files, such as mosquitto.conf, are included in the Torizon OS image, please consider the following steps:

  1. Check File Paths: Verify that the paths specified in your docker-compose.yml for the source of the bind mounts are correct. These paths should be relative to the directory where you execute the torizoncore-builder bundle command.

  2. Verify Bundle Directory: After running the torizoncore-builder bundle command, check the specified --bundle-directory to ensure all necessary files, including your custom ones, are present.

  3. Configuration in tcbuild.yaml: Ensure your tcbuild.yaml file correctly references the bundle directory. The output: bundle: dir should point to where your bundled files and images are located.

  4. Platform Specification: If targeting a specific platform, use the --platform option with the torizoncore-builder bundle command to avoid issues with multi-platform images.

  5. Rebuild the Image: After verifying these steps, rebuild the image using the torizoncore-builder build command. This should incorporate all bundled files into the final image.

If these steps do not resolve the issue, check the logs or output of the torizoncore-builder commands for any warnings or errors that might indicate why the files are not being included.

I hope this helps resolve your issue.

Best regards,
Toradex AI Assistant

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

Docker-compose.yml.

Hi @masterfoo

In the steps you described, there is no part where you configure a file to be present on your device.

    volumes:
      - type: bind
        source: mqtt/mosquitto.conf
        target: /mosquitto/config/mosquitto.conf
      - type: bind
        source: scripts/
        target: /scripts

Just for clarification, this part of the docker-compose is saying that you want the file mqtt/mosquitto.conf that is already present on your device, to be available at /mosquitto/config/mosquitto.conf inside the container.

Note that this is about the docker container, and it’s unrelated to Torizon OS.

Also note that this source path refers to a path on your device, not on your computer, and it’s unrelated to torizoncore-builder.


What you can do to create an image where the mosquitto.conf is use the /etc folder with the capture changes

1 Like

Thank you Allan, you are correct, I misunderstood how it works I eventually used the filesystem node in tcbuild.yml