Live data from Hacker News

Docker on MacOS is slow and how to fix it

paolomainardi.com

21–30 of 211 posts

Re: Docker on MacOS is slow and how to fix it

#21

Earlier quoted context omitted.

Have fun managing osx and Linux dependencies then when you could just maintain one.

When I used to use a mac I just put all my "Linux" (GNU really) dependencies in a prefix and that worked pretty well. Docker is kind of overkill for what people use it for IMO.

I used to be on the side of relying on native tools/libs, and managing them in a similar way to what you to describe, but it all became too much to handle, with dependencies across projects breaking with regularity.

Maybe I wasn't doing it right, but switching to Docker to sequester my projects and their dependencies has saved me so much time and hassle, especially with the amount of repos I work on throughout the year.

My biggest weakness today is that I still don't reach for Docker right away when starting work on a new project or when evaluating a new tool. Old habits…

Re: Docker on MacOS is slow and how to fix it

#22

What sort of workloads are people doing where the filesystem access is limiting them? I develop python web apps on a mac and use dockerized postgres and a dockerized flask app. I don't seem to experience any noticeable issues. When I am developing I mount the source code directory as a volume so code edits are synced live into the running docker container. I also develop frontends using vue, managed by npm. In my exp…

A customer's Mac with a M1 is only 50% faster than my Intel laptop from 2014 at running Rails tests, because they run in a docker container: 50s vs 75s. The difference between the two machines should be much more than that (CPU, RAM, data bus, etc.)

Re: Docker on MacOS is slow and how to fix it

#23

What sort of workloads are people doing where the filesystem access is limiting them? I develop python web apps on a mac and use dockerized postgres and a dockerized flask app. I don't seem to experience any noticeable issues. When I am developing I mount the source code directory as a volume so code edits are synced live into the running docker container. I also develop frontends using vue, managed by npm. In my exp…

One issue I ran into at my previous employer was pylint on a large Python codebase. Pylint is slow on the best of days, but the difference on an M1 Mac running under docker (to standardize the version and settings across the team) was something like 10x as slow; several *minutes* to lint the codebase, which we absolutely required before code could be checked in. It finally got a lot better when VirtioFS came out, which, when enabled on an arm64 image, sped up filesystem access dramatically; suddenly my lints were taking seconds again.

Re: Docker on MacOS is slow and how to fix it

#24

Earlier quoted context omitted.

When I used to use a mac I just put all my "Linux" (GNU really) dependencies in a prefix and that worked pretty well. Docker is kind of overkill for what people use it for IMO.

I used to be on the side of relying on native tools/libs, and managing them in a similar way to what you to describe, but it all became too much to handle, with dependencies across projects breaking with regularity. Maybe I wasn't doing it right, but switching to Docker to sequester my projects and their dependencies has saved me so much time and hassle, especially with the amount of repos I work on throughout the ye…

My point was that you can do this without docker. On Linux you can use separate chroots for each project, on OSX you could probably do that too but since prebuilt tools for generating a darwin rootfs are rarer prefixes are easier.

Re: Docker on MacOS is slow and how to fix it

#25

My preferred fix: don't develop in Docker.

Have fun managing osx and Linux dependencies then when you could just maintain one.

And also there is some additional fun dealing with broken or incompatible packages whenever you upgrade OSX

Re: Docker on MacOS is slow and how to fix it

#28
post #11

Is not this the main way to speed up Docker on Mac: use a beefed up Linux Virtual Machine (VirtualBox, UTM, tart) and run Docker inside this Virtual Machine?

the 'DOCKER_HOST' variable (and the fact that all SDK's seem to support it) is honestly the greatest bloody thing in the entire ecosystem. My workflow for the past 3 years with Docker has been: set up some desktop machine somewhere, configure docker, configure ssh like normal: set DOCKER_HOST=ssh:// on my laptop. Docker responds as if it's local, but I get absurd build/fetch speedup (since the wired connection is fas…

I assume port forwarding would be a pain in such a setup, right?

Re: Docker on MacOS is slow and how to fix it

#29

What sort of workloads are people doing where the filesystem access is limiting them? I develop python web apps on a mac and use dockerized postgres and a dockerized flask app. I don't seem to experience any noticeable issues. When I am developing I mount the source code directory as a volume so code edits are synced live into the running docker container. I also develop frontends using vue, managed by npm. In my exp…

I tried running our Golang mock generator through Docker on an M1 Mac and it was much slower than running it directly on the host. Probably since it reads every file in the codebase and writes out a file for every interface it finds.

Re: Docker on MacOS is slow and how to fix it

#30
post #19

Earlier quoted context omitted.

My preferred fix: don't develop in Mac.

Unfortunately Mac is the best in terms of hardware and portability and for compliance stuff

yeah, I really wanted to buy a Linux laptop. I highly value battery life though and the m1 chip doesn't really have a competitor in that department.
Post reply on HN