How do I create a bootable image with balena?

The documentation on balena is quite limited on this topic.

I can build normal docker images and run them in my Raspberry Pi 3 with balena, but how do I make them bootable; And how do I do the update regarding “to allow the bootable container to update itself.” in #10?

What do you mean by bootable images? Could you please detail further your use case?

From the changelog it tells that the most recent version of balena supports booting into a container, where I interpret it as custom images behaving just like what Resin OS do.

But the documentation up there at is really lacking the details.

So what you want to achieve is virtualizing resin devices as docker containers, is that right?

Yes and no.

I don’t want the always online feature and all the booting prerequisite of resin os, but Iove the containerization and self update.

In theory I can implement my own update/recovery mode, or scheduling, and boots alpine in seconds when in daily use.

Hi @vicary

Bootable containers require quite a bit of ceremony to get up and running which is currently done as part of our yocto build process. I’ll try to give you an overview and point you to the relevant pieces of code but be prepared to get your hands dirty :slight_smile:

Before starting coding anything I suggest downloading an image of resinOS and inspecting the structure of the root filesystem. You’ll see a few directories and symlinks that all work together to define which container should be booted from. This structure is set up by this script .

You can see some more info about this structure in the description of this PR

The only real requirement is for your container to have a statically compiled mobynit in /boot/init in the container.

So all in all, if you manage to create a root filesystem that has the correct structure and an Alpine container that contains a statically compiled mobynit binary (named init) in the right place you should be able to boot a device. Unfortunately giving a very detailed guide here would be a lot of work. We plan of writing a blogpost explaining all this however and as this feature matures provide utilities that help people create custom setups.

Wow didn’t expect this level of clarity, thanks so much!

Took a quick look at the root filesystem, without knowing what to look for, I don’t think I have everything yet.

I’m looking forward to the blog post.