Skip to main content
Version: Torizon OS 6.x.y

Application Software Installation on Torizon OS

Introduction

Torizon OS uses containers as the key technology for installing and running application software. How to install software with containers is a common question, and this article is a reference on how to install common software technology.

This article focuses on tools, utilities, or software developed and distributed in a ready-to-use form. If you want to learn the installation process of the application you are developing, take a look at the Torizon Application Development Overview.

What is covered:

  • Use existing pre-built containers from the community to run software.
  • Install the software in the Debian Containers for Torizon.
  • Install the software in other base containers.
  • Install the software in a container created from scratch.

What is not covered:

Prerequisites

To try out the installation of any software on Torizon devices you will need to:

  • Get a SoM (Sytem-on-Module) running Torizon
  • Basic understanding on connecting and running commands on the SoM

A good place to get started is the Quickstart Guide.

Pre-built x Debian Containers for Torizon x Other Containers

Before learning how to install software, you must choose the approach that best suits your needs. This section provides some guidance.

Debian Containers for Torizon are built on top of Debian, meant to solve common hardware-access permissions such as graphics acceleration, and are tested and maintained by Toradex. They are flexible and leverage the Debian package feeds, making it easy to install virtually any open-source software, libraries, tools, and your application, no matter whether it's written in an interpreted or compiled language.

Pre-built containers are useful for running software that doesn't require modifications, interpreted programming language engines, web servers, and databases, among others. Often, popular software is packaged as a container and provided on public registries such as Docker Hub and Red Hat Quay.io.

Other containers are often built on top of base pre-built containers that are meant for generic purposes, such as a Linux distro container such as Debian, Alpine, Ubuntu, Fedora, Arch, and others. While they don't solve the common Embedded Linux hardware-access use cases and are not maintained by Toradex, they may be suitable options in some cases. Alpine Linux, for example, is known to be a very small distribution and can help you save space. Ubuntu may have newer versions of libraries than Debian, and if your software needs those you can use them without having to rebuild them from the source.

Creating a container from scratch means that you have an empty filesystem to copy things into. It allows you to create the smallest and arguably most secure containers because in there you can handpick every single application, library and dependency to be installed into it. On the other hand, this may lead to increased engineering effort to create and maintain your software.

Lastly, it is very common to use multiple containers, so that you can have a weighted outcome: you can build a minimal container from scratch with a statically compiled application that controls a critical process, and at the same time use a pre-built container to serve statistics through a webserver, and have them exchange information in a private internal network that does not have access to the internet.

How to Install Software on Containers

In the previous section, you have chosen a container approach - or a combination of approaches - to run your application. In this section, you will learn how to install software into them.

First and foremost, be aware that Docker and, more broadly containers, are technologies that although adopted by Torizon are much more widely adopted across various software communities, from embedded to server applications. No matter how much we strive to document related knowledge, you must leverage the rich Docker Docs and the virtual infinity of content available out there on the web. Here, we focus on the basics and Embedded Linux use cases.

Debian Containers for Torizon

Everything you need to learn about how to install your application into and run a Debian Container for Torizon is available on the Toradex Developer Website.

The Torizon IDE Extension takes care of setting up a project from the template, already using the Debian Containers for Torizon whenever possible. It also deploys and runs containers on the board. This is the fastest, recommended way for getting started with application development, including installing software.

For a great experience either with Torizon IDE Extension or with the CLI, read the following articles:

Although the IDE is the recommended development workflow, for the sake of completeness, here is an example of installing a package - the sl - in a Debian Container for Torizon by building a new container on top of it. On the board, create a Dockerfile:

Dockerfile
FROM torizon/debian:3-bookworm

RUN apt upgrade -y && apt install -y sl && \
apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*

CMD ["/usr/games/sl"]

Build and run your container:

# docker build -t steam-locomotive:3 .
# docker run --rm -it steam-locomotive:3

Keep in mind that the example above ignores some advice and best practices: it builds a Dockerfile directly on the target device, and it does not make use of the Torizon IDE Extension.

Using Debian-based containers, Torizon makes it easy to migrate software developed for other platforms. You can have insights from our Blog Migrating Machine Learning Applications from Raspberry Pi.

Pre-built Containers

To run a pre-built container, you can use the regular Docker and Docker Compose documentation for running containers. Toradex provides an entry point for Application Development, and you may want to check the following resources:

As an example, let's take the official container build of Nginx, a project commonly known as a web server (though it can do much more). The hyperlink leads to the Docker Hub page where there are instructions on how to run it, and for the sake of completeness, you can find the instructions below as well:

# docker run --name some-nginx -d -p 80:80 nginx

On your computer, open a web browser and navigate to http://<board-ip> and you will see the default "Welcome to nginx!" page.

To add a pre-built container to a Torizon IDE Extension project, which we strongly encourage for application development, you must edit the project's Docker Compose file.

Keep in mind that each pre-built container will have its own instructions for bring-up.

Other Containers

The Torizon IDE Extension is flexible and you can use other containers as a base in different ways:

  • Create a project from the template and edit the initial Dockerfile FROM statement to use the container you want.
  • Create a template of your own, based on the ones provided in the vscode-torizon-templates repository. Consider submitting it as a community template.
  • Submit a request for a new community template. This may take time and depend on the community's interest to create such a template.

Regardless of using the IDE or the Docker CLI, you can use pretty much any container image that is supported on Arm or Arm64, depending on your SoM CPU architecture. In the following example, build an image based on Alpine:

Dockerfile
FROM alpine:3
RUN apk add --no-cache fortune
CMD ["/usr/bin/fortune"]

Build and run your container:

# docker build -t fortune:3 .
# docker run --rm -it fortune:3

Keep in mind that the example above ignores some advice and best practices: it builds a Dockerfile directly on the target device, and it does not make use of the Torizon IDE Extension.

Create a Container from Scratch

Creating a container from scratch may lead to the smallest possible container. Keep in mind that there are very small distributions such as Alpine, and that spending the extra effort to create a container from scratch may not be worth it. On the other hand, from a security perspective, you can handpick all software that goes inside the container, and as long as you choose only software that you trust, the final image may be more secure.

In the following example, a statically compiled C application is built. The base Alpine container builds it against the musl libc, leading to a smaller binary than if using a more traditional Linux distribution with the glibc. Only the resulting binary is copied to the final container that is built from scratch:

Dockerfile
# Build container
FROM alpine:3 AS build

WORKDIR /app

RUN apk add --no-cache build-base

RUN printf '#include <stdio.h>\n int main(){ printf("Hello World"); }' > main.c

RUN gcc -static -o hello main.c

# Runtime container
FROM scratch

COPY --from=build /app/hello /app/hello

CMD ["/app/hello"]

Build and run your container:

# docker build -t hello:3 .
# docker run --rm -it hello:3

Keep in mind that the example above ignores some advice and best practices: it builds a Dockerfile directly on the target device, and it does not make use of the Torizon IDE Extension.

Common Software and How to Install it

You have learned about the possible ways to install software in a container, and how to do it. Until now, the examples were generic as they focused on the base knowledge so you can install any software.

In this section, some common use cases are gathered to provide a quick starting point for specific software installation.

tip

This is an opinionated and likely outdated section, meant to be a starting point only. You are encouraged to do your research to determine if the software listed here, as well as the installation methods described, are up-to-date and meet your use case criteria.

In the upcoming sections, pre-built container images are preferred whenever they are available and well-maintained by official sources. Otherwise, Debian Containers for Torizon are used as base container images.

Web browser

Toradex provides pre-built Chromium and Cog containers with hardware acceleration. Read the article Web Browser / Kiosk Mode with TorizonCore for more details on how to use them.

PDF Viewer

Several PDF viewers are available for Linux. Evince has been tested for a demonstration and is known to work in fullscreen and presentation mode without user intervention.

You can install evince with apt-get install -y evince, copy your presentation to the final container and start it with the command evince --presentation my-presentation.pdf, so that it starts in fullscreen.

For a practical learning, check this PDF viewer Demo on GitHub.

Web Server

Pre-built container images for popular web servers are available for Arm:

  • nginx container images are available for Arm and Arm64.
  • Apache container images are also available for Arm and Arm64.

Database

Pre-built database containers are widely available. Additionally, you can install other databases in a container, in case the pre-built ones don't suit your requirements. Here are some examples:

Low-Code Programming

There are several low-code rogramming tools available both as open-source and proprietary applications. Examples that provide pre-built containers:

  • Node-RED is a low-code programming framework for event-driven applications. Read the article Node-RED on TorizonCore for more details on how to use it.
  • n8n is a node-based workflow automation tool. It has not been tested by Toradex, but pre-built Arm and Arm64 containers are available, as well as instructions on the official n8n docs website.

Other Software

Would you like to see another software category featured in this article? Write a request in the Toradex Community, and it will be evaluated.



Send Feedback!