ARM Container Applications: Accelerating Development and Testing

By Yili

Image for post
Image for post

With the era of 5G around the corner, highly reduced network latency, improved hardware computing capability of Artificial Intelligence (AI), and rapid growth of intelligent applications, the Internet of Everything is inevitable. Therefore, we must extend the intelligent decision-making capability and the real-time processing capability from the cloud to the edge and to the Internet of Things (IoT) devices.

Alibaba Cloud Container Service already provides edge containers to integrate the cloud, edge, and devices. However, there is a need to support Advanced RISC Machine (ARM) chips as well as x86 chips in IoT and edge computing scenarios. While the home-grown ARM CPUs are rapidly developing, ARM-based containers should also get ready.

This article introduces some simple techniques to speed up the development and testing processes of ARM container applications.

Build an ARM-based Docker Image in the x86 Environment

Recently, Docker and ARM announced their partnership program for optimizing Docker tools to improve developers’ experience on the ARM platform. Docker developers build container images for ARM devices on the x86 desktop and deploy container applications onto the cloud, edge, and IoT devices. The entire container building process is very simple without cross-compilation steps.

Docker Desktop is a container development environment for macOS and Windows platforms. Docker uses the virtualization technologies in the host’s operating system, such as Hyper-V on Windows or HyperKit on MacOS, to run the Docker development environment. To support ARM CPUs, the latest Docker version adds the QEMU simulator to the container-dedicated operating system, LinuxKit. Currently, applications based on the ARM/v6, ARM/v7, and ARM64 architectures are supported. The architectural diagram is as follows:

Image for post
Image for post

Now, let’s take a look at the steps to build an ARM-based Docker Image in the x86 environment.

First, install the latest edge version of Docker Desktop. Note that the Docker Engine version must be later than version 19.03.

Image for post
Image for post

Enable the experimental features in Docker Desktop by choosing Preference… > Command-Line > Enable experimental features.

Image for post
Image for post

Add the command to Docker as shown below.

The following snippet shows the current status of the builder.

Create a mybuilder instance as the default builder, and activate the ARM building capability.

Obtain the test application from GitHub using the commands below.

Next, create a test repository in Docker Hub.

Image for post
Image for post

With the support of the new image mediaType manifest list, Docker implements the multi-architecture Docker imaging feature since Docker registry v2.3 and Docker 1.10. This feature allows one image to contain imaging layers in various CPU architectures.

Build a multi-CPU architecture image for the test application, including the support for x86, ARM64, and ARMv7, and then push it to Docker Hub.

The following snapshot of Docker Hub shows the image information.

Image for post
Image for post

Run the built image on a macOS machine as shown below.

Visit to confirm that the current CPU architecture is .

Image for post
Image for post

Log on to a Raspberry Pi, which runs on ARMv7-based Raspbian, and execute the following command to run the same container image.

Open a browser and visit to see that the current CPU architecture is ARMv7l.

Image for post
Image for post

Run an ARM-based Docker Image in the x86 Environment

Begin with building an ARMv7 image as shown below.

In the Linux kernel, register an “interpreter” using . Call the custom interpreter when running an executable file. In Linux 4.8, the is added to to allow the kernel to load the interpreter during configuration instead of during running. This feature is known as lazy load. This helps to register and run the interpreter for the ARM instruction set by using containers.

Run the following command on a macOS machine. An ARM image starts without making any modifications.

Visit to confirm that the current CPU architecture is ARMv7l.

Image for post
Image for post

Summary

The article concludes that the integration of containers, operating systems, and virtualization technologies simplifies the support for multi-CPU architecture-based applications. Such integration allows to easily build and test ARM applications on the x86 platform.

References

Original Source:

Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store