How to Autorun an Application With TorizonCore
Docker, the main engine behind the management of Containers within TorizonCore, is already configured to start at boot.
And together with it, there is a service called docker-compose, which will initialize the containers described by a docker-compose.yml file present in
/var/sota/storage/docker-compose/ directory of your TorizonCore system.
You can, of course, create your own Systemd service and start your container through the execution of its "docker run...", but using the docker-compose.yml as mentioned above is the preferred way of starting a Container with TorizonCore.
Please have an overview of the Docker-compose for more details.
Evaluation: TorizonCore with Evaluation Containers Example
With Toradex Easy Installer, you can install TorizonCore with Evaluation Containers.
It brings together several containers focused on development, like Weston and Portainer, already set to start at boot together with Docker.
Please feel free to install TorizonCore with Evaluation Containers and study their configuration and parameters.
Development: Considerations About the Start/Restart Behavior of Your Container
Leaving your docker-compose.yaml file at
/var/sota/storage/docker-compose/ directory will make your containers automatically start together with the system. And there are also some adjustments you can make in order to control the behavior of your containers.
That can be done with the restart flag, which can be set through the command line, by docker run or docker update, or by setting the parameter restart at docker-compose.yml for the given container image.
For both command line and docker-compose.yml, the restart parameter flag can assume one of the following values:
- no: Do not automatically restart the container. (the default)
- on-failure: Restart the container if it exits due to an error, which manifests as a non-zero exit code.
- always: Always restart the container if it stops. If it is manually stopped, it is restarted only when Docker daemon restarts or the container itself is manually restarted. (See - the second bullet listed in restart policy details)
- unless-stopped: Similar to always, except that when the container is stopped (manually or otherwise), it is not restarted even after Docker daemon restarts.
As mentioned previously, the preferred way of starting containers with TorizonCore is through a docker-compose.yml at
The restart flag parameter is a complement to make it possible to automatically restart given container images, which is done by Docker itself.
Production: Pre-Provisioning Docker Containers onto a TorizonCore Image
Once you have your docker-compose.yml structured and validated, you can pre-provision a customized TorizonCore image with that, so you can use it for flashing several units, which is very useful for production.
You can find more details about this process in our article Pre-provisioning Docker Containers onto a TorizonCore Image. With the resulting image at the end of this process, the containers defined in your docker-compose.yml will be set to be started automatically.
The process of pre-provisioning a TorizonCore image with custom containers makes use of our TorizonCore Builder Tool.