When you run Docker "on" a Mac, you are actually running the Linux version of Docker inside of a hypervisor. Docker tries to make this as transparent as possible, but there is a performance penalty.
If you're on an M1 Mac and using an x86 container, you're also doing CPU translation. And unlike Rosetta, it's emulating a full CPU, not passing to native libraries.
It's more of a file system issue. At least in my case it is. For reasons I don't know Docker interacts with the file system much much slower on Macs than natively. All of the time I mentioned is loading a Rails app before it can run the first test. That takes 100 times longer through Docker. Once it's up and running performance is fine.
My understanding is that the “file system issue” is a direct result of Docker running in a hypervisor rather than natively. Virtual Machines can achieve near-native CPU performance, but they get bogged down by other important details such as file sharing.
On Windows, it is more or less the same. I ended up having all my files in the VM and keep windows as a shell around everything. That way, it all feels almost native Linux. Can you do the same on Mac?
You can run Linux VMs on Apple Silicon Macs, yes, using a kernel hypervisor framework built and supported by Apple.
I’d feel remiss to not also mention Asahi Linux, which runs on bare metal. It’s not quite ready for prime time yet, but I’d be surprised if it wasn’t within a year, at most. But, I also wouldn’t make a purchase based on that.
I've been thinking about moving from Docker for Desktop to minikube (but just for the docker part). I hear it's better although it still uses hyperkit.