Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ChaosAngel

macrumors member
Original poster
Sep 29, 2005
91
14
UK
Docker for Mac performance continues to be horrible on the M1. Does anyone know if Docker plan to improve this situation? Are they already using the Apple Hypervisor framework (I'm guessing not).

As an example, I have a simple JAMstack (Jekyll) build, which takes approximately 70 seconds to complete on my My Dell XPS 17 (Intel Core i9-11900H) using an x86 image. This is the case running Windows 11 (WSL2) or Linux (Pop!_OS).

The same build (with an ARM64 image) takes 460 seconds on the M1 Max, with Docker assigned 8 Cores and 8GB.

However, if I launch Linux (Ubuntu Server ARM64) via UTM, I can execute the exact same build in just 9 seconds!!!

9 seconds is an incredible result, but it is painful that I have to run a local Ubuntu image to achieve that performance.

Any thoughts? Any way to optimise the performance of Docker on macOS?
 

ChaosAngel

macrumors member
Original poster
Sep 29, 2005
91
14
UK
Thanks for sharing. Good video, although the presenters experience was a little different to mine.

I am definitely seeing significant bottleneck with Docker for Mac on M1.

I am not sure if it relates to Docker itself, which I think is using QEMU on the Mac or a software I/O limitation.

Either way, it is hard to ignore a 9 second build time (UTM - Linux) vs 460 second build time (macOS)

Anyone else using Docker on M1/Pro/Max?
 

vigilant

macrumors 6502a
Aug 7, 2007
640
225
Nashville, TN
Thanks for sharing. Good video, although the presenters experience was a little different to mine.

I am definitely seeing significant bottleneck with Docker for Mac on M1.

I am not sure if it relates to Docker itself, which I think is using QEMU on the Mac or a software I/O limitation.

Either way, it is hard to ignore a 9 second build time (UTM - Linux) vs 460 second build time (macOS)

Anyone else using Docker on M1/Pro/Max?
I don't, but I probably will be soon once my M1 Max comes in today, and once I get to that point in my lab to mess with it.

I'm fairly new to Docker and Kubernetes, having focused mostly on enterprise virtualization and public cloud for a number of years so I expect it to be fun.

I do agree with the guy in the video that was posted. I'm happy to be wrong on this, but just having managed developers for a number of years I can tell you Dev tools are usually the slowest to adjust to changes in the Apple Ecosystem. That is unless you are using Xcode. I haven't looked in a while, but last time I looked Visual Studio for Mac is still not in a complete Beta form just yet, and it's been a year.
 
  • Like
Reactions: bloomberg

CarbonCycles

macrumors regular
May 15, 2014
114
110
VS Code for Mac has come a long way and it's slowly becoming my favorite...I'm disappointed to hear about Docker's performance on the M1 Max
 

ChaosAngel

macrumors member
Original poster
Sep 29, 2005
91
14
UK
Have spent some time tuning Docker on the Mac and have improved the performance.

I had not realised that you have to enable the use of the Apple Hypervisor framework (it is under Experimental Features). This improved performance significantly (460 seconds to 220 seconds). However, it is still a long way from the Dell XPS 17.

I also optimised my volumes as I suspect my issue is actually I/O. I have a fairly heavy file load (4000+ / 800MB). In short, I think this is the killer.

With this in mind, I will likely keep Ubuntu running in UTM, which completes the build in less than 10 seconds. That really demonstrates the power of M1 Max! I have never seen another machine complete the build that quickly, including my Ryzen 3950 (16C/32T) desktop running WSL2.
 

ADGrant

macrumors 68000
Mar 26, 2018
1,557
928
Have spent some time tuning Docker on the Mac and have improved the performance.

I had not realised that you have to enable the use of the Apple Hypervisor framework (it is under Experimental Features). This improved performance significantly (460 seconds to 220 seconds). However, it is still a long way from the Dell XPS 17.

I also optimised my volumes as I suspect my issue is actually I/O. I have a fairly heavy file load (4000+ / 800MB). In short, I think this is the killer.

With this in mind, I will likely keep Ubuntu running in UTM, which completes the build in less than 10 seconds. That really demonstrates the power of M1 Max! I have never seen another machine complete the build that quickly, including my Ryzen 3950 (16C/32T) desktop running WSL2.

Did you use Docker on an Intel Mac? If so, how did that compare with your experience on the M1 Macs?
 

ChaosAngel

macrumors member
Original poster
Sep 29, 2005
91
14
UK
Did you use Docker on an Intel Mac? If so, how did that compare with your experience on the M1 Macs?
Yep, I have used Docker on Mac for many years.

For obvious reasons, the experience using Docker is far superior on a Linux host. Therefore I do most of my web-based development on Pop!_OS. With that said, following the release of WSL2 on Windows, the Docker experience vastly improved (making it a viable development environment for my workflow).

Docker on macOS has always been a pain (my experience), especially when working with mounted filesystems. It basically kills performance when working on projects with large file volumes.

Regarding Intel vs. M1 on macOS, I would say the experience depends on your specific workload, but for me is fairly equal (I had an i9 MBP 16-inch - 32GB).

However, if you run Linux on the Mac with UTM, you can truly unleash the M1 Max. As an example, my Dell XPS 17 achieves a build time of around 70 seconds. With Ubuntu Server via UTM, the M1 Max achieves the same result in just 9 seconds (which is the fastest I have ever seen).
 
  • Like
Reactions: msephton

ChaosAngel

macrumors member
Original poster
Sep 29, 2005
91
14
UK
I have decided to stick with my UTM + Ubuntu Server (ARM64) setup on my M1 Max MBP.

With SSH configured and have enough RAM, the impact of running the server locally is fairly low.

This setup has resulted in 9 second build times, which compared to 220 seconds on Docker for Mac is a major step forward.

220 seconds does not sound like a long-time, but when you're waiting for the build to complete multiple times per day, it feels like an eternity.
 

appleshill

macrumors newbie
Nov 27, 2021
1
0
I created an account because you seem the perfect person to ask this question seeing as how you are an active docker user and have experience with both the 2019 16 inch MBP and the new M1 models.

In the next couple of months I am looking to upgrade from my 2018 13 inch MPB. It has a quad core i5, 16GB ram, 256GB SSD. I use docker regularly for personal full stack projects. On a given day, I could be doing anything from dockerized backend microservices to front end IOS/Android and lately my laptop feels abysmally slow especially when connected to two 1440p monitors...

I have always been one to buy a used macbook from a couple models ago on ebay to save some cash. But these new M1 models looks like they deliver a compelling option to just shell out more money. I've found some used 16 inch macbooks from 2019 with the i9 and 32gb ram 1TB SSD for around $1900.

Do you think that is a better option than a similarly configured M1 Pro with 32gb ram 1TB SSD for closer to $3000? With a developers use case in mind do you think the extra cost is worthwhile?
 

ADGrant

macrumors 68000
Mar 26, 2018
1,557
928
I have decided to stick with my UTM + Ubuntu Server (ARM64) setup on my M1 Max MBP.

With SSH configured and have enough RAM, the impact of running the server locally is fairly low.

This setup has resulted in 9 second build times, which compared to 220 seconds on Docker for Mac is a major step forward.

220 seconds does not sound like a long-time, but when you're waiting for the build to complete multiple times per day, it feels like an eternity.
For running Ubuntu Server on your Mac, have you tried using Ubuntu Multipass? Seems simpler than UTM but it is of course limited to just virtualizing Ubuntu.
 

leman

macrumors P6
Oct 14, 2008
17,049
14,790
There's a very long, in-depth article here, explaining why Docker for Mac is so slow, and what your options are:

If I understood it correctly, the summary is that Docker seems to have horribly messed up their Mac version.
 
  • Like
Reactions: msephton

gernot.kogler

macrumors newbie
Nov 13, 2014
19
11
Why Lima and not podman? What is the advantage of Lima over podman?
I don't know. I stumbled over a blog post describing how to replace docker desktop with lima /nerdclt. Tried it and it worked out of the box as a drop in replacement for docker, much faster and stable. What would I gain from switching to podman?
 

Xiao_Xi

macrumors 6502a
Oct 27, 2021
731
406
Last edited:

dgdosen

macrumors 68020
Dec 13, 2003
2,335
977
Seattle
Docker for Mac performance continues to be horrible on the M1. Does anyone know if Docker plan to improve this situation? Are they already using the Apple Hypervisor framework (I'm guessing not).

As an example, I have a simple JAMstack (Jekyll) build, which takes approximately 70 seconds to complete on my My Dell XPS 17 (Intel Core i9-11900H) using an x86 image. This is the case running Windows 11 (WSL2) or Linux (Pop!_OS).

The same build (with an ARM64 image) takes 460 seconds on the M1 Max, with Docker assigned 8 Cores and 8GB.

However, if I launch Linux (Ubuntu Server ARM64) via UTM, I can execute the exact same build in just 9 seconds!!!

9 seconds is an incredible result, but it is painful that I have to run a local Ubuntu image to achieve that performance.

Any thoughts? Any way to optimise the performance of Docker on macOS?

This is puzzling to me:

- There's a video above that seems to show what the dev experience is on with M1/M1Pro/M1Max native Docker:
. It seems pretty reasonable and mirrors my feelings - although I haven't benchmarked anything myself.
- It looks like you could install Intel Docker Desktop on M1 via Rosetta. I hope you're not doing that...
- Running Docker on M1 will force you to manage the architectures of your underlying images. Are you using arm64 images? x86_64 through Rosetta? multiarch?
- 8 Cores? how complex is your stack? My goal is the minimum resources for the containers work and debug locally (dev environment) then push it to a server for more testing.
 
Last edited:

dgdosen

macrumors 68020
Dec 13, 2003
2,335
977
Seattle
There's a very long, in-depth article here, explaining why Docker for Mac is so slow, and what your options are:
FYI - this article was written before Apple was shipping M1 macs, and logically, before Docker (Docker Desktop) natively supported Apple Silicon.
 

ADGrant

macrumors 68000
Mar 26, 2018
1,557
928
FYI - this article was written before Apple was shipping M1 macs, and logically, before Docker (Docker Desktop) natively supported Apple Silicon.
The author was using an Intel Mac and complaining about the Docker for Mac performance on Intel.
 

gernot.kogler

macrumors newbie
Nov 13, 2014
19
11
This article has a comparison between nerdctl and podman. https://codeengineered.com/blog/2021/podman-vs-nerdctl/

It seems podman has better compatibilty with Docker than lima. You could run podman as it it was docker with alias docker=podman.

Besides that, Red Hat develops podman, so it could have better support than lima.
Thanks for the link. I tried podman but lima / nerdctl works better for me. All I need is a tool to start docker-compose files. podman cannot do that out of the box and after installing podman-compose it didn't bring it up correctly (the docker-compose file contains postgres, teedy and nginx as a reverse proxy). lima / nerdctl just work. Nice to have a choice, though, I will watch what's going on with podman...

Btw. Docker Desktop (arm64 native, of course) started my docker-compose just every other time. At least half of the time it just got stuck in the middle of the boot and when it booted sucessfully, it took forever compared to lima / nerdctl.
 
  • Like
Reactions: Xiao_Xi
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.