Autorun container after Torizon image installation

I created my custom image by Torizon Builder and I add also in the docker image of my application.
When I install OS image all works fine, but my application is installed as docker image but not as a running container. I have 2 questions

  1. How can I run automatically the first time without run the command “docker run my image”, (after this command the container starts always)
  2. I need create a folder and default files inside in my root, in order my container app works properly, is this possible using torizon builder? I need to connect the first time and create this by mkdir otherwise my container doesn’t start properly.

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

Did you like my answer?

:+1: :-1:


To address your questions based on the provided context:

  1. Automatically Running a Container: To have your container start automatically after installing your custom Torizon image, you should use a docker-compose.yml file. Place this file in the /var/sota/storage/docker-compose/ directory of your Torizon system. This file should define your container and its configuration. When the system boots, the docker-compose service will automatically start the containers defined in this file. This is the preferred method for starting containers automatically on Torizon OS.

  2. Creating a Folder and Default Files: The context does not provide specific details on using TorizonCore Builder to create folders and files directly on the root filesystem during the image creation process. However, you can potentially achieve this by customizing the Dockerfile of your application container to create necessary directories and files when the container is built or started. Alternatively, you might need to manually create these directories and files on the device after the initial boot if TorizonCore Builder does not support this directly.

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

Adding additional DTB files via TorizonCore builder.

Hello @fabrizio.camagna,

The response from @ToradexAI is a viable solution, but you can achieve all of this using TorizonCore Builder as well.

With TorizonCore Builder, you can Bundle containers into an image: Pre-provisioning Docker Containers onto a Torizon OS image | Toradex Developer Center

These containers will be automatically started on boot.


Regarding the files in the base image, the suggestion to include default ones in the containers is valid.
If that is not an option, you could also add them to a running image and capture the changes with TorizonCore Builder: Capturing Changes in the Configuration of a Board on Torizon OS | Toradex Developer Center

Best Regards,
Bruno

Hello @fabrizio.camagna,

Is this issue resolved?
Or do you still need support with this topic?

Best Regards,
Bruno