With the onset of the fourth industrial revolution, we see the end of conventional embedded systems in industrial usage. The Industrie 4.0 demands that systems be interconnected or networked in such a way, that they are easily upgradable and maintainable.
Application deployment and updates on the conventional systems including proprietary elements, is a generally tedious task, and can become a security risk in the long run. Firmware and software updates are important to ensure the smooth functioning and security of the systems. How does containerization solve these issues? Let’s understand containers first.
VMs & Containers
Virtual Machines run using Hypervisors as provided by Oracle VM VirtualBox, VMware, etc., running on the Host operating system. Hypervisors monitor the operation of a Guest operating system, which has binaries and libraries to run an application. For many years, VMs have been the sandbox for testing applications for cross platform development and support, and for scaling server applications.
Containers are a similar platform. However, they do not have an entire guest OS running, but only the binaries and libraries necessary to run an application.
The Container Engine works with the host OS kernel to run the app images that include the bins/libs, and the source code needed to run the application. It is an alternative to VMs with even more flexibility for the apps.
Containerized Embedded Systems
Being lightweight alternatives of VMs, containers can easily run on lightweight OS’ like Raspbian. Many community-supported, container-based OS’ are also available, such as BalenaOS, Hyperiot and Ubuntu Core. These operating systems can run on devices such as Raspberry Pi and Beaglebone, which are small and powerful enough for industrial IoT applications. Let’s take a look at the benefits of using containers on these devices –
- Application Image Management
One of the concerns of the IoT supported industry, is to deploy and manage applications on the numerous devices that come with it. App images contain the binaries and libraries necessary to run the application, which indicates that we need not have all the packages installed on the Host OS. On the conventional systems, before any update, the existing libraries on the system must be taken into consideration. Changing the code-base for better performance, for example, will require a full-stack upgrade- a rather tedious process, which finally results in piled up libraries that are no longer necessary. With containers, such an upgrade is not difficult to implement, even on multiple devices.
- Clustering and scaling
Applications require resources, which are not abundant on embedded systems. Container engines come with cluster managers such as docker swarm, to share the workload amongst the many small devices in the cluster. This is important for a further application type we’re about to discuss.
- Edge Computing and Convergence
The idea of Edge Computing is to bring some of the services to the internet edge, or gateway. In IoT, this means bringing high computational devices to a local level, where the action is going on. With containers and clustering, we can implement server applications at a local level. These scaled down servers can be assumed to be the base of future developments in industrial IoT.
Implementing Containers on a Raspberry Pi
Raspberry Pi is a versatile device, ideal for IoT in various forms. Implementing containers can help us achieve the above mentioned necessities, and test it.
In order to do so, we go through a simple 3 step process:
- Installing a lightweight OS, such as Raspbian lite.
- Installing Docker Container Engine (Or avoid this step by using Balena, Hyperiot or Core)
3. Building the app image with dependencies, and deploying it.
Beginning with simple APIs, to advanced Image and Video Processing and analytics, all types of applications can be implemented on such a system with the right dependencies. In the following demonstration, an app image is built to support a simple Flask based REST API.
As apparent, it will install the dependency, flask while building the image.
For any resource intensive application, or application scaling, docker swarms can be used to increase the capabilities of the service. It is to be noted that a very lightweight OS with no libraries of its own, was installed. All bins/libs are installed to the container only. These bins/libs can be reused by another app-image if needed, owing to the layered structure of the app-images.
Although containers aren’t new, they are still developing, and have a significant part to play in the upcoming generation of industries. Industries can now have enhanced automation with scaled down server applications at the site, and highly manageable embedded devices, with streamlined software to monitor and control the many systems.