Balena deployment image size as microservices

Dear Balena Developers,

We are developing a ROS based drone and are using balena to provide OTA updates and recently, I started wondering in what way balena / docker is suited to run ROS as microservices (With sets of nodes, or even single nodes, being containerized as microservices).

The problem that we currently have is that we now deploy a single monolith image of our whole software stack, which limits our interation/development speed and we are looking into modularization and, as we do OTA updates over 4G, updates to clients get expensive quickly.

So my question is this. If we want to run ROS as microservices, what would be the OTA update file sizes, and what is your recommended way?
Currently I am thinking of restructuring our code similar to the following example:

  1. Take an official ROS docker image (200 MB)
    branch into 3 different images (A/B/C) for 3 different nodes:
    2)install ros node (A/B/C) specific libraries on this image (50/60/70 MB)
  2. install the ros node itself (10/20/30 MB)

Are my assumptions correct in this sense? :

  • Initial deployment will cost 200 + 50 + 60 + 70 + 10 + 20 + 30 = 440 MB? (Or 3x200 + … = 840 MB?)
  • Updates on node A’s library will, at most, cost 50 + 10 = 60MB?
  • Updates on A’s library, but not it’s code, will still cost 60 MB?
  • Updates on node A’s code will, at most, cost 10 MB?
  • Updates on the base image will cost a full 440 MB again?

Regarding the deployment, will balena deploy recognize that B, and C, are not changed and thus not modify/update their images? Are there specific commands / settings that I need to be aware of to make sure balena deploy doesn’t update B and C?

All of the questions are regarding minimizing image size / update size / modular design, is there anything that I might have missed? Is this the recommended design pattern for a ROS+Balena software stack?

Greetings and thank you for your time.


If you are using Balena Cloud (which I would suggest) it will be much less due to delta updates: Delta updates - Balena Documentation (not available in Open Balena I believe). The exact amount is hard to calculate as it depends on what you change. Other than that it’s mostly about the way the Dockerfiles are written and ‘layering’, which is worth reading about and I’m sure if you post your dockerfiles we can all help out (although Delta updates far more important, Docker layering more just good practice and faster builds).

I just got sucked in by the ‘ROS based drone’ topic. What is it you are aiming to do exactly? Sounds really interesting.

Oh and your 440 MB calc looks right to me, based on what I think a node is. If all running on the same device and same Balena os the 200mb image is shared by all 3 so doesn’t need multiplying by 3. But you could also use Balena preload so all of that is on the OS before you flash it to the device. That way it doesn’t have to travel through the 4g and only relies on updates from then on.