News for hackers. Stuff that matters.
Re:Docker for Mac M1 RC by cactus2093 on Friday March 19, 2021 @07:44AM (#26512181)
The only problems I’ve had with docker slowness (though it’s been a very significant problem) is shared file system performance. It’s made many use cases and tools that are slow to begin with (like webpack) basically unusable for a development workflow.

So the main thing Apple could do to show some love to docker is build out full apfs support in the Linux kernel. I have no clue how much work that entails but presumably it’s pretty massive, and it seems totally unlike them. Maybe one day they’ll have a come to Jesus moment like Microsoft and start caring about developers (non-iOS developers) but I don’t really see it happening.

Re:Docker for Mac M1 RC by unilynx on Friday March 19, 2021 @07:52AM (#26512224)
If you found this unusable, you probably haven't had to work with the Virtualbox-backed version of Docker for Mac :-)

Have you considered storing the npm_modules and running webpack on a tmpfs/volume (so that it doesn't have to go through the shared FS layers) and only copying the end product to a shared volume?

Re:Docker for Mac M1 RC by mbrumlow on Saturday March 20, 2021 @11:13AM (#26523700)
Or maybe we can realize that npm and webpack are both trash. And we should stop embracing them and move web dev away from this mess.

Don't get me wrong. They were good workaround years ago. But I hope we can do better.

Re:Docker for Mac M1 RC by derefr on Friday March 19, 2021 @10:47AM (#26513932)
Creating and mounting a loop-volume within the HGFS and then running NPM in there, would probably also be helpful. It certainly is when wrangling a directory with lots of tiny inodes over SMB. (It’s also what Apple themselves do for running Time Machine over SMB: they create a sparsebundle image on the remote and mount it locally, and write to that.)

(The efficient thing about this class of solutions, if you’re wondering, is that the client mounting the loop-image ends up owning + managing the loop-image’s internal filesystem’s metadata within its own local disk cache, such that it can coalesce filesystem metadata writes and only push a new copy of the disk-image blocks backing the filesystem metadata after a potentially-huge number of changes. With a network/host-guest filesystem, meanwhile, every filesystem metadata change must become its own synchronous message to the host, to be pushed to the host’s filesystem driver for linearization, so it can succeed or fail relative to other things going on within the host.)

Re:Docker for Mac M1 RC by girvo on Friday March 19, 2021 @08:46AM (#26512620)
I used to run my own Xhyve based VM just to avoid the brutal VirtualBox Docker system on macOS. Man that’s some bad memories.

The newer Docker for Mac is better, but file system perf still could be massively improved. Big node_module directories can still cause pain even today

Re:Docker for Mac M1 RC by llimllib on Friday March 19, 2021 @10:17AM (#26513597)
> Big node_module directories can still cause pain

is there any other kind?

Re:Docker for Mac M1 RC by booi on Saturday March 20, 2021 @04:17PM (#26525792)
Bigger node_modules directories
Re:Docker for Mac M1 RC by tshaddox on Friday March 19, 2021 @02:18PM (#26516673)
Yep, using Webpack in Docker on a Mac is essentially unusable. I see around a 5-10x slowdown in Webpack builds. Using docker-sync seems to help the CPU out a bit, so my MacBook Pro doesn't do the jet engine space heater routine quite as much, but the performance is still nearly unusable.

https://docker-sync.readthedocs.io/en/latest/

Re:Docker for Mac M1 RC by aguilarm on Friday March 19, 2021 @02:39PM (#26516904)
webpack can be made use-able relatively easily if you do not mount node modules over the shared file system. I've been doing this for quite awhile with a volumes declaration in docker-compose that looks like this (running nextjs, assuming /usr/src/app is where your dockerfile has your node stuff):

(on service definition): volumes: - .:/usr/src/app:cached - node_modules:/usr/src/app/node_modules/ - next_artifacts:/usr/src/app/.next/

and then in the top level volumes key defining node_modules and next_artifacts as blank/default.

That means I mount everything except node modules and the build artifacts so the shared filesystem does a LOT less work trying to sync stuff. The downside, of course, is that I need to run npm commands both inside the container and outside if i want them in my IDE. A fair trade for decent performance. That setup is still not as fast as native but definitely usable and does not send my machine into space header mode much more than normal usage.

Re:Docker for Mac M1 RC by tshaddox on Friday March 19, 2021 @02:47PM (#26516984)
Interesting. I have always had the same docker-compose setup with a separate node_modules volume inside Docker, but I've always still had the jet engine space heater issue.
Re:Docker for Mac M1 RC by bdcravens on Friday March 19, 2021 @04:41PM (#26517964)
I've been able to improve performance in docker-sync by adding high-churn folders that I don't care about to sync_excludes
Re:Docker for Mac M1 RC by GordonS on Friday March 19, 2021 @02:56PM (#26517071)
Virtualbox-backed Docker on Windows was my first introduction to Docker - it literally put me off touching Docker for 1-2 years!

After eventually falling in love with it on Windows and Linux, I later tried it on MacOS... oh my. Not fun!

Re:Docker for Mac M1 RC by cowmix on Friday March 19, 2021 @11:11AM (#26514220)
The fact you need to partition off RAM and CPUs for Docker on the Mac is the killer for me.
Re:Docker for Mac M1 RC by laurencerowe on Friday March 19, 2021 @01:38PM (#26516136)
Don’t you have to do that under windows too given WSL2 also runs as a VM?
Re:Docker for Mac M1 RC by merb on Friday March 19, 2021 @01:46PM (#26516243)
no not in wsl2. (you can, but there is no need for that) (btw. disk storage can be too small, but that is the only problem that can occur https://docs.microsoft.com/de-de/windows/wsl/compare-version...)
Re:Docker for Mac M1 RC by rcarmo on Friday March 19, 2021 @02:20PM (#26516692)
Actually that's done for you, whether you control it or not. WSL2 is essentially a VM with better host integration.
Re:Docker for Mac M1 RC by merb on Sunday March 21, 2021 @05:18PM (#26534169)
actually under hyper-v windows is a vm aswell, it's just not visible. it's the reason why the hyper-v hypervisor platform was needed.
Re:Docker for Mac M1 RC by whimsicalism on Friday March 19, 2021 @10:31AM (#26513754)
The shared filesystems are also quite buggy.

I was developing a database as a personal project that involves mmapping a file and the Docker shared filesystem had some peculiar behavior they was different from how normal filesystems work.

Re:Docker for Mac M1 RC by DanHulton on Friday March 19, 2021 @12:41PM (#26515444)
That _used_ to be a problem for me, until I found Mutagen. It is _surprisingly_ easy to set up, and my webpack builds in Docker are only about 5-10% slower than running natively.

https://nodewood.com/blog/how-to-speed-up-docker-on-macos/

Re:Docker for Mac M1 RC by zaphirplane on Friday March 19, 2021 @05:23PM (#26518260)
Sounds like you like Linux but run windows ;) yeah outlook word
Re:Docker for Mac M1 RC by leoc on Friday March 19, 2021 @12:26PM (#26515251)
Apple (as you may know) did in fact have a spell as open-systemsy Unix-loving guys, starting from the NeXT acquisition but ending no later than the release of the iPhone. The usual pattern, basically: https://news.ycombinator.com/item?id=7525256 .
Re:Docker for Mac M1 RC by anthk on Friday March 19, 2021 @07:43PM (#26519285)
Ah, yes, the Unixness of the Lisa, the LCII, the Quadra, the System 7, Mac OS 8.1, Mac OS 9.2...

So much Unixness on the Mac OS boot ROM, the Pascal API, the lack of memory protection, and so on...

Re:Docker for Mac M1 RC by leoc on Saturday March 20, 2021 @08:44AM (#26522805)
Please reread my comment.