Building aarch64 image with Docker27 Jan 2020
Most of us may use x86 architecture to run your application usually. x86 machine is a dominant architecture in the data center and desktop application. Of course, this blog is also written in the MacBook Pro running on Intel Core i7. But you may want to run your application on the machine running with different CPU architecture from time to time. Most mobile devices support Arm architecture. Additionally, cloud service providers such as AWS provide new generation machine running in Arm-based processor. It is not strange even if we want to run our application on a different platform seeking a chance of better performance or stability.
Nowadays, Docker is the first option to run our application quickly bundled with necessary prerequisites. Using Docker is a sound idea to apply the new platform to the existing app.
To experiment Presto run Graviton processor, I have tried to create a Docker image supporting Arm platform. Here is an article briefly describing how to create a Docker image supporting Arm.
Docker buildx is an experimental feature for the full support of Moby BuildKit toolkit. It enables us to build a Docker image supporting multiple platforms, including Arm. The feature is so useful that we can quickly make the cross-platform Docker image with a one-line command. But the feature is not generally available in the typical installation of Docker. Enabling the experimental flag is necessary as follows in the case of macOS.
And make sure to restart the Docker daemon.
We can build the Docker image for Presto supporting aarch64 architecture with buildx command. We can specify the target platform with
--platform option as follows.
$ docker buildx build \ --platform linux/arm64 --push .
--push option lets us upload the image without issuing another command to do so.
We will find the image supporting the target platform uploaded in the Docker Hub. The good thing is that the Docker engine automatically checks the target platform validity by using that information. It is helpful to search and run the image supporting our desired platform.