Docker + M1 + ARM64
Over the past few weeks, I have been testing the new Apple MacBook Air, equipped with the Apple M1 System on a Chip (SoC).
The two articles linked below document my initial thoughts and findings.
Docker compatibility is an important part of my workflow, therefore I was to see the release of the public preview earlier this month.
As documented in the article “Docker on Apple M1” all core functionality appears to be working as designed, however, as highlighted by the table below, performance is sub-optimal.
As part of my testing, I used this blog (LifeinTECH) as common workload, which installs and configures Ruby, Gems, Jekyll and Bundler, before building my Jekyll static site, which is approximately 400MB.
Although Docker supports multi-platform images, the official Jekyll Docker image does not include an ARM64 version. Therefore, like all x86 images running on Apple Silicon, the QEMU emulator is used, which I suspect is having a significant impact on performance.
As a result, I set up an arm64 version of the official Jekyll Docker image, which should run natively on the Apple M1.
I ran the build multiple times to help identify any anomalies.
As you can see from the table below, the MacBook Air receives a huge performance boost.
Not only does the MacBook Air now outperform my 16-inch MacBook Pro, but also my Razer Blade 15 Advanced, when running Docker via virtualisation (no WSL). These are impressive numbers that are more in line with what I had expected from the Apple M1.
It is worth noting that Docker running via WSL 2 on Windows 10 still offers the best overall performance, thanks to the fact that Microsoft has included a native Linux Kernel as part of WSL 2. I would love to see Apple offer the same capability, but this is very unlikely based on their tightly controlled ecosystem.
In conclusion, if you plan to use Docker on Apple Silicon, I highly recommend selecting images that include native support for the ARM64 architecture.