Apple Silicon: Docker is much slower directly under macOS than by virtualizing Linux 🆕 |  MacGeneration

Apple Silicon: Docker is much slower directly under macOS than by virtualizing Linux 🆕 | MacGeneration

Updated on 29/12/2021

Docker developers contacted us to report an important performance issue. More than the system used to run the app, it's the type of container that can make the difference on Apple Silicon Macs. If one is running an x86 container, one needs to add an emulation layer on top of the virtualization that is always present with Docker and this can significantly slow down performance. In the example of our reader, this is a priori the explanation for the gain by switching to Ubuntu: an arm64 container has been created, which eliminates this additional intermediary.

That being said, there are still known performance issues with Docker on macOS, particularly related to file handling. A task has been open on this since spring 2020 and experimental versions are offered to correct, at least in part, these problems.


original article

Apple Silicon : Docker est beaucoup plus lent directement sous macOS qu’en virtualisant Linux 🆕 | MacGeneration

Docker's app for macOS has been optimized for Apple Silicon Macs since last spring, but that doesn't mean everything works perfectly for this popular software container manager in the web development world. A reader alerted us to a funny bug: the initial container build takes a long time on his MacBook Air M1 with 16 GB of RAM. It's not the computer that's at fault, as it performs much better on the same machine and through Linux.

In his tests, he noted a huge difference for creating the same container with the macOS version of Docker and the version built into Ubuntu, a Linux distribution. While it takes him about 2,600 seconds to get his container ready to use with the macOS app, it only takes him 210 seconds to achieve the same result using Linux. That's over 12x faster, on the same MacBook Air and even as it adds a layer of virtualization on top of macOS!

There is obviously a big bug in Docker that justifies this large discrepancy. Anyway, this reader has noted other similar testimonials, including this article from LifeinTech published last November which gives figures with an Apple M1 Max much more powerful than the Apple M1 mentioned above. The processor is not in question and the best result of all the tests carried out by the site is provided by the MacBook Pro, but in virtualization under Linux once again.

What is surprising is that this problem is not recent and it is easy to find testimonies since the spring. Why aren't Docker developers fixing it? Is it a bug on their side, or on the side of Apple and macOS? Digging a little deeper reveals other articles that predate the release of Apple Silicon Macs and complain about the poor performance of Docker for macOS. The software suffers a priori from poor optimizations that the transition to Apple's new chips could have accentuated.

While waiting for a fix, the easiest way seems to be to go through a Linux distribution in virtualization on top of macOS. This makes two virtual layers instead of one, but the figures that can be crossed prove that it works. By using Multipass, one can obtain a virtualized Ubuntu with a single command line and very quickly, this is the solution finally used by our reader on his MacBook Air M1.

Multipass: Ubuntu on M1 Macs in less than a minute

Tags: