Bundling Containers into Device Images

I’ve done some searching on the internet and this forum but I’m not having luck finding a guide. Perhaps I am using the wrong keywords.

I’m looking at https://github.com/balena-os/balena-intel

Ideally I would like to bundle some containers into the image for the device to avoid having to download. I could maybe bundle binaries and bind-mount the binaries into a Docker Container and then run it to save some bandwidth?


Hey @stephanbuys, it sounds like what you’re looking for is the balena preload CLI command - see the docs for that here: https://www.balena.io/docs/reference/cli/#preload-image

Let us know if that does what you need.

Hi, thanks this is actually very interesting. Is it also possible to make very specific network configurations like setting IP addresses, DNS servers, NTP, gateways, etc?

What I was actually asking was is there a way to bundle extra data/large files into the image to avoid having to download them from balena when the device starts the first time, which seems to be addressed there - thank you.

I’ll try answer my own question, now having read the docs. From what I’ve seen (I’m very new) you can use containers to change the settings I’m interested in, you can then bundle these apps/containers/commits into the image using preload and they will do their magic from the start then. We’ve got some use-cases where there isn’t DHCP so a pointer to an app that can change network settings (and how to preload it) would be very much appreciated.


for a guide on how to do preloading (and preregistering) you can refer to the advanced cli masterclass here: https://github.com/balena-io/balena-cli-advanced-masterclass#5-preloading-and-preregistering

as for apps that deal with network configuration, something like this will basically translate into a container on balenaOS: https://askubuntu.com/questions/246077/how-to-setup-a-static-ip-for-network-manager-in-virtual-box-on-ubuntu-server/936249#936249

Make sure to enable access to the host dbus via the supervisor label: https://www.balena.io/docs/reference/supervisor/docker-compose/#labels