What advantage is there in using docker containers for a single application embedded system?

Honestly, all I see are disadvantages, and a lot of work jumping over hurdles presented by the limitations the docker container imposes…

Hi, I’m the Toradex AI Assistant.

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


I understand your concern—containers can seem like overhead for single-application systems. However, there are several concrete advantages even in this scenario:

Key Advantages for Single-Application Systems

Decoupling Application from Base OS(1)

  • Updates to the base OS can be done without needing to change and test compatibility for your application against new library versions(1)
  • Your application development is detached from OS updates and dependencies(2)

Vendor Responsibility for OS Maintenance(1)

  • The hardware vendor (Toradex) takes on the responsibility of maintaining the base OS, freeing up your valuable time and engineering resources to focus on the unique aspects of your product(1)

Efficient Dependency Management(1)

  • You can swiftly install dependencies within your container using popular package managers and feeds like Apt and Debian packages, eliminating the need to use Yocto Project to integrate them into the base OS(1)

Security by Default(1)

  • Containers have limited access to hardware resources unless you grant them permission, allowing for a more controlled and secure system design(1)
  • You can design your system so parts of your application only have access to a limited set of the base OS functions and devices(1)

Platform Portability(1)

  • Containers can run on various hardware platforms as long as a container engine is available, ensuring portability(1)

Addressing Common Misconceptions

Performance Impact(1)

  • Containers aren’t lightweight VMs—they are a means to sandbox a process from accessing resources on the outside while still using the same kernel as the base OS(1)
  • There is no processing performance impact using containers, as it runs on the same base OS kernel(3)

Storage Overhead(1)

  • Due to containers using a layering system, as long as you share the same base among containers, you can actually use less storage(1)
  • Even if you use a different base container, the overhead size will range from dozens of MB to maybe a couple hundred(1)

RAM Overhead(1)

  • Shared libraries are only loaded more than once if they have different versions—which is not a common scenario(1)
  • Even when using different base containers, the overhead ranges within hundreds of kB to dozens of MB and is still negligible in contrast to a RAM-intensive application(1)

Hardware Access(1)

  • Hardware access is possible, and Toradex templates, samples, and documentation already solve common access patterns so you can focus on application development(1)
  • GPU acceleration and access to embedded buses are quite common(1)

Alternative: Torizon OS Without Containers

If containers truly don’t fit your use case, Toradex offers the Torizon OS Reference Minimal Image(2), which provides Torizon Cloud features (OTA updates, remote access, device monitoring) without the container runtime(2). You would use standard Yocto workflows instead(2).

The Torizon IDE Extension, together with templates and documentation, enables you to start developing your application even with zero knowledge of Docker(1).

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.

There is not independence from the OS. We have to build our own version already, for some reason I forget, and we have to test our application with any new OS before distributing to customers.

It is easier and quicker to install packages directly using APT directly on the command line, where you can actually understand and control what’s happening.

There is significant pain and overhead in granting containers the resources they need, which are significant, since many parts of the OS need to be controlled by the single UI app. Maybe there is some argument for increased security, but I’m not sure - when running bash in a container using docker exec as a normal user, I am given root privileges in the container. Perhaps I can’t access everything though.

We only run on a single, tested platform.

The disadvantage in terms of the VSCode IDE extension development environment is monstrous in comparison. I don’t think I have ever spent less time focusing on development… I certainly spend significant time waiting - even in debug it takes 5 minutes to launch the application even a build is not required !

Well, I’m not convinced - if no-one manages to present any better argument soon, I will be reverting to the Minimal Image and bitbake…

I completely understand your frustration—your points are valid for your specific workflow. Based on what you’ve described, the Torizon OS Reference Minimal Image with Yocto appears to be the better fit for your use case(1).

Why the Reference Minimal Image Makes Sense for You

Direct Yocto Workflow(1)

  • The Torizon OS Reference Minimal Image is designed for developers who need deep customization at the operating system level(1)
  • It provides the foundational components of Torizon without containerization, allowing integration and modification within a Yocto SDK environment(1)
  • You still get the benefits of Torizon’s secure OTA updates (OSTree and Aktualizr) without the container overhead(1)

Your Workflow Fits This Model(1)
Since you’re already:

  • Building your own OS version
  • Testing the full stack together before distribution
  • Running on a single, tested platform
  • Finding the container development workflow slow and cumbersome

…the Reference Minimal Image approach aligns much better with your needs(1).

How to Proceed

The Torizon OS Reference Minimal Image can be built with Yocto(1). It’s highly recommended to use Yocto Project to add your application, customize, and rebuild Torizon OS from source by using its reference image as a base(1). This approach ensures that the final image is tailored to meet your specific needs and does not require the usage of containers(1).

You can follow the instructions to Build Torizon OS with Yocto(1).

What You Keep vs. What You Lose

You Keep:

  • Torizon’s secure OTA update infrastructure (OSTree/Aktualizr)(1)
  • Toradex’s maintained BSPs with updated software for bootloader and Linux kernel(1)
  • The Torizon Cloud features for remote updates and device management(1)

You Lose:

  • Container isolation and sandboxing
  • The ability to update applications independently from the OS
  • The IDE Extension workflow (which you’ve found problematic anyway)

Given your current pain points and workflow requirements, moving to the Torizon OS Reference Minimal Image with standard Yocto development seems like the right decision for your project(1).

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.

IIUC you can do this with Torizon Cloud using the same method as for M4 FW updates - right?

Hi @Timo!

Yes, you can.

You can find a video explaining how to do that in our Subsystem Updates Overview article. You would follow the same steps, but use your application binaries instead of firmware.

Best regards.

I suspect that privilege control, which docker is supposed to provide, can be equally well provided by running the GUI application as a user with controlled privileges and setting up AppArmour.

Does anyone have any experience to suggest otherwise ?

I’ll bite and toss in my two cents here - we also have a single-application setup and our dev team vastly prefers the container workflow over our legacy “application is baked into the OS” approach which we had been using for many years before and we were initially of the same mindset - “why would we want this added complication, it seems unnecessary” - but that was because we were both unfamiliar with docker and also struggling to see how it would fit in with the environment and flow we were familiar with.

We don’t use the off the shelf extension as-is development flow and have somewhat customized it to deal with some of the issues you mention (slow process to build and deploy) but also because we were working with an existing build setup rather than a fresh slate.

We build our containers via CI as multi-platform so it’s possible to run the same software on a regular desktop for additional debug capability, while running in an environment as close as possible to what the embedded container is seeing.

By far the biggest benefit we found is separation of host and application libraries; yes some items can be shipped alongside the application itself in a no-container setup but in other cases you are stuck because e.g a glibc update is non-trivial and in one scenario you now need to update your whole OS, likely an entire major release version, whereas in the other you select a newer base container to derive from for your application only and the OS can stay where it is until you can afford the development cycles to address it and move it forward for that or other reasons.

The other massive benefit is platform abstraction if you need to manage the same software on multiple device or hardware types - the OS underneath might be different but the runtime environment is not. Still one SW build on all devices, or migration - far less of a lift to containerize an existing application in an environment it is used to and then swap out the OS underneath, migrating the SW later, than it is to try to get that all done and validated at once.

Our SW does some hardware access but it’s limited in scope - though I can absolutely agree with one of your frustrations where if a lot of complicated or nuanced hardware or OS interfacing is needed, containerization may not be the choice for you.

Note though that with your apparmor example, while you may restrict what the application (or a user that found an exploit in it and now has a shell) can do, they can still inspect things like the user- readable parts of your root filesystem. If the application is containerized, they only see the container’s contents and any explicitly shared resources. Whether this matters for you comes down to your particular threat model and security needs, of course. Your container can contain a much smaller subset of libraries specific to what your application needs than the host OS itself, which can eliminate an entire attack surface for the difference between what Torizon itself needs to run vs what your application needs - an exploit in a host library or tool not relevant to your SW isn’t automatically viable inside a container, whereas it could be in a docker-less setup.

At the end of the day all that matters is which model works best for your needs and future plans, and if that doesn’t involve docker, there’s nothing wrong with that.

Hi Bjorn !

Many thanks for your excellent reply :slight_smile: I found it very helpful.

I have to admit that my original post was made in a moment of some frustration :joy: Since we have found solutions for our issues, things are settling down. At some point in the near future, we will have to make a decision between investing in improving the container workflow, or reverting to bitbaking our system.

I think our decision will rest partly on the maturity of our threat model (it lags as ever) and also verification and multi-platform requirements. Currently we envisage only a single embedded platform, so verification of an OS update is not onerous. On the other hand, I can’t seem to clear the fog from my crystal ball :wink:

Glad it was informative :slight_smile:

The important bit, of course is that so long as you have a good update model, you’re not stuck with what you choose now; the door remains open to moving to a docker-based build at any point in the future should it become necessary - or vice versa.

Good to hear you’re getting things sorted out, nothing is more frustrating than a new tool or architecture change getting in the way of things you are trying to do - and at least for us, that’s one reason why our dev team welcomed the docker approach with open arms as the bitbake process can have a steep learning curve and it’s easy to lose a lot of time trying to get it to do something that’s blocking you from fixing something else.

:joy:for us, it was the exact opposite - we had bitbake under control, and had to face a steep learning curve for docker…

Actually @Bjorn,

One of our main issues is the build time, since it’s done in a WSL in Windows, and iiuc there’s an emulator (we’re talking close to an hour for a clean build). Even debug is slow, and apparently buggy (I end up having to reboot my PC on occasions).

Which build client are you using to target Torizon ?

Clearly there are significant problems related to the default Torizon Extension. I don’t suppose you could share your build system scripts - any pointers as to how we might get started customising what we have ?

If I can find time - as you say, these things are getting in the way of what we’re trying to achieve, rather than helping us…

We are using the c++ cross-compile toolchain containers offered by Toradex to build for ARM64 using native x64 compilers. You are right that using the torizon/binfmt emulation introduces a LOT of overhead to projects that are non-trivial. The compile then happens at near-native speeds and the only tasks that must happen “under emulation” are the final container setup, i.e. installing its dependencies and copying in the binaries you built in using the development container. You can even make a more tailored cross-compile toolchain using Yocto’s populate_sdk feature and bake that into a canned cross-compile environment to reduce the “jump” from your existing stack to a more generic toolchain and set of system libraries.

Unfortunately I can’t share entire build configurations but I’m happy to share some tricks and pointers that should help significantly, especially if you’re just getting started with docker. We do most of this with CMake and VS code tasks to achieve this.

  • Read up/learn how docker layering works to understand what causes portions of images to rebuild (the term is cache-busting when a dockerfile change on a particular line triggers all the subsequent build directives to re-run) and how you can structure them with “low churn” items first, so that e.g. you don’t spend time reinstalling packages with apt-get every rebuild when only your final application binary has changed. Same if you have shared libraries that don’t change often, consider prebuilding them with versioned storage and re-using the binaries instead of a fresh compile every time.
  • Take the above a step further and pre-build a “base” reference image that houses all of the system runtime dependencies for your application, and tag/publish it for re-use, so that the final Dockerfile for your application does the bare minimum it needs to (i.e. copy in any non-system libraries, binaries, and configurations/resources you built).
  • Learn about multi-stage docker builds in a single Dockerfile to leverage the speed of a cross compile for e.g. c++ where it’s possible. Run your build steps in a host-native container, then use COPY --from=[build_container] ... in your subsequent runtime container construction.
  • For local builds, use the toolchain container as an execution environment, (i.e. use docker run ... and don’t run your build in the actual Dockerfile) with a shared volume of your sources on disk. This lets you make the most of your build system to stop rebuilding things that haven’t changed, otherwise a source change on disk busts the cache an your entire project compile re-runs.
  • The default behavior on the Toradex extension is (or was, when we used it) was to rebuilt the entire container all the time and then re-push it to the device which can be slow if you’re only making small changes. To work around this, create build scripts/helpers that do the following:
    • rsync the binaries you built over to the device in a known location
    • Launch a modified docker-compose configuration that volume-mounts your development binary directory into the runtime container over top of where it usually sits. Then future recompiles and re-pushes should be very quick as they will only push what changed, and restarting the container already on the device will automatically pick up the changes from the flat-file copy - no more overhead of repushing an entire container image. This last one is an extreme optimization because if your Dockerfile is well structured with your application binary copy last, only this final docker layer will change and be re-pulled by the device - but not all build setups “play nice” with this.
    • Consider how you are connecting to your device to deploy - ethernet? WiFi? etc - this plays a huge role in how long it takes data to push and e.g. 54 MBit wifi << 100M ethernet << a direct USB-ethernet-gadget ssh connection at either 480MBit USB 2 << GBit ethernet << (or even higher USB 3) speeds.
    • Another cheat: Don’t fall into the trap of “docker save” to a .tar, sftp the tar, “docker load” to transfer images - you can pipe data directly from one docker instance to another if you are not using a docker registry as a transfer mechanism. e.g: docker save my-image:latest | ssh torizon@[my-device-ip] -C "docker load" will get your device processing and unpacking the incoming data before the transfer completes, turning 3 serial steps into something that is largely only limited by the rate at which you can transfer the data to the device and how fast ‘docker save’ works on your host machine.

Hope those are useful; I’ll try to answer any questions if you have them.

Wow, awesome - many thanks @bw908 those are some obviously useful tips. Perhaps some could be employed in the default torizon template without loss of generality :wink:

All I need now is to find a pile of round tuits :joy: