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
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 https://github.com/resin-os/meta-resin/blob/master/meta-resin-common/recipes-containers/hostapp-update/files/hostapp-update .
You can see some more info about this structure in the description of this PR https://github.com/resin-os/meta-resin/pull/805
The only real requirement is for your container to have a statically compiled mobynit https://github.com/resin-os/balena/blob/17.06-resin/cmd/mobynit/main.go 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.