Balena: A Moby-based container engine for the IoT

After Moby brought open source to Docker containers, Balena goes one step further with an emphasis on IoT use cases. While it is fully compatible with Docker containers, Balena has more support for the Internet of Things.

As Docker binaries have grown in functionality, the amount of space they’ve needed has grown accordingly. Unfortunately, IoT devices aren’t especially known for their large storage space. And so, the folks at Resin.io have come up with Balena, a new Moby-based container to improve IoT functionality.

As we covered earlier this year, Moby is an open-source projected intended to allow for a greater level of collaboration and advance the software containerization movement. Billed as the “Lego Club” of containers, Moby makes it easier to assemble specialized container systems without reinventing the wheel. Specifically, Moby was constructed and designed for system builders who are aiming to build their own container-based systems.

Balena

Obviously taking a cue from Moby’s whale theme, Balena itself is a nod to the baleen found in most whales. Baleen are often known as whalebone. Likewise, Balena should be a sturdy, underlying containerized foundation for IoT devices.

The specs are pretty impressive. Balena boasts more efficient bandwith with startling smaller binaries. It also uses RAM and storage more conservatively and focuses on the durability of container pulling. Balena currently only supports Linux.

Balena:

Adds the ability to perform true container deltas, 10-70 times more bandwidth efficient than the standard layer-based Docker pull.

Adds the ability to perform atomic and durable image pulling, meaning you won’t end up with a corrupted container if power is lost in the midst of an update. This is not something one plans for in a datacenter, but is a daily occurrence for devices in the physical world.

Is conservative about how much it writes to the filesystem, performing on-the-fly extraction of pulled layers and avoiding writing the compressed layer to disk.

Prevents page cache thrashing during image pull in order to work well in low-memory situations.

Supports build-time volumes, enabling more flexible container building workflows. This is also a feature needed for the resin.io builder.

Need for speed

Balena does a great job of improving efficiency for IoT devices. According to the Resin team,it supports container deltas for 10-70x more efficient bandwidth usage. Here are their pull test comparisons:

Minimal footprint

IoT devices generally have a limited amount of space. So, the goal for Balena was a reduced footprint. Although it achieves this goal, it had to sacrifice a number of Docker features, including Docker Swarm, support for plugins, cloud logging drivers, overlay networking drivers, and stores that are not backed by boltdb, such as etcd, consul, zookeeper, etc.

In comparison to Docker, Balena is fairly conservative for things like page cache. Docker optimitzes for pull speed, which eats up a lot of memory and space. But Balena has every file synced to disk, after which it informs the kernel that it can discard the pages. This means that page cache usage is minimal, even if the pull speed is slower. However, the folks at Resin suggest that they might be able to improve pull speed in the future.

More

Interested in trying out Balena for yourself? It can be found at balena.io or on GitHub.