03 November 2015 / Last updated: 27 Jan 2017

Our first experiments with multi-container apps

Execution time:

...and our plans for the near future

Resin.io provides an ultra-easy way to deploy a Docker container to remote devices, empowering the next generation of IoT devices. We are aware that one of our most important features to add is smooth support for applications that need more than one container, and this is a key piece of our roadmap.
While looking into what would be the best way to implement this, and thinking about the UX involved, we have already done a few working "experiments" with multi-container apps, that would allow users to deploy these kind of programs while we work on the complete solution.
These experiments are based on docker-in-docker, an app that runs a docker daemon within a docker container. This setup allows users to run several containers using any of a variety of well known tools like Docker Compose or Fig.
The first experiment uses Docker Compose to build and run two containers on the device. It is a very simple-to-use solution for users who don't care about the first-boot overhead of building the containers.
After doing this, we expanded this same idea and managed to run a Kubernetes node in this repository.
Kubernetes is an open-source solution created by the Google Cloud Platform team that allows the deployment and scaling of "pods", that is, groups of containers with a shared network namespace, across a cluster of nodes.
The Kubernetes networking model is not completely implemented in our demo, but we were successful at deploying and running a pod in a Resin-powered Raspberry Pi, using an AWS server as the master node. Doing this involved playing a bit with the Kubernetes code to adapt it to running on ARM and Resin. This example would allow users to treat a group of embedded devices as a distributed cluster, and assign heterogeneous (and potentially complex) applications to different devices in this cluster.
Finally, in the last few weeks, we've helped one of our users set up an AeroFS Appliance on an Intel NUC running Resin. For this, we created a simple repository adapting one of AeroFS' docker scripts and mixing it with our docker-in-docker implementation. This app pulls the different containers required to run the appliance and starts them.
In all of these implementations, the main problem lies in the fact that the multiple container images aren't being built with the Resin cloud builders, so we can't take advantage of this tool that really simplifies the build process. One of our first next steps, then, will be to implement the ability to deploy multi-container apps using a single git push as a regular Resin application. The main way to do this that we're considering now is to enable building docker images from within the app's Dockerfile, exposing an API to the docker daemon that runs on the builders.
The next step will be to adapt the Resin Supervisor so that it is aware of these multiple containers. That way we can monitor these containers as we currently do for apps, and we'll be able to then integrate them with our UI to provide Resin's other features like logs and Web Terminal.
It's an interesting road ahead, and we're very eager to hear your feedback, ideas and suggestions as to what you would like to see in Resin's multi-container support. You can post a comment here, start a discussion in our forum, or leave us a message. If you want to implement a multi-container solution using one of these examples, let us know and we'll be happy to give a hand!
by Team balenaThe global group of product builders that brings you balena

Share this post