Live data from Hacker News

LXD containers on macOS at near-native speeds

beringresearch.github.io

61–70 of 134 posts

Re: LXD containers on macOS at near-native speeds

#61
post #40

So is there some canonical guide to running a docker compose style app on Mac m1 machines that has good filesystem performance? It seems like there’s many ways to approach the topic now so it’s hard to tell which one is “winning”. I’d love to containerize all of my local development efforts (scripts and rails apps) but the slow ass filesystem always ruined it in the past.

Because docker for Mac has always kind of sucked, I’ve moved on to making nix-based development environments and I’ve been very pleased so far. Lately I’ve been trying https://devenv.sh/ and it works great! I haven’t tried it for ruby, though I have used vanilla nix shell for ruby projects before and it worked quite well after I over-rode GEM_PATH and GEM_HOME to the correct values.

help me understand

nix file helps you build OCI image and then you run it not locally/somewhere else?

can that be compared apples to apples to docker where you can build with Dockerfile syntax, and then run locally the image?

Re: LXD containers on macOS at near-native speeds

#62

Earlier quoted context omitted.

Because docker for Mac has always kind of sucked, I’ve moved on to making nix-based development environments and I’ve been very pleased so far. Lately I’ve been trying https://devenv.sh/ and it works great! I haven’t tried it for ruby, though I have used vanilla nix shell for ruby projects before and it worked quite well after I over-rode GEM_PATH and GEM_HOME to the correct values.

I've been using Colima lately and it's been a great experience. The only thing that didn't quite work was pushing an image to AWS ECR, but pulling images, building images (with BuildKit), and running containers all worked fine, and faster than Docker.

isn’t Buildkit Docker?

Re: LXD containers on macOS at near-native speeds

#64
post #32
post #10

Earlier quoted context omitted.

lxd is so much easier than alternatives like systemd-nspawn. 3 minutes search reveals an easy to follow tutorial. https://ubuntu.com/server/docs/containers-lxd

Thanks but I wasn't talking about lxd, but about the underlying technology.

> underlying technology

I'm guessing bocker would be more useful for that: https://news.ycombinator.com/item?id=33218094

Re: LXD containers on macOS at near-native speeds

#65

Earlier quoted context omitted.

QEMU can use the MacOS virtualization framework layer to run a VM built for the same arch without going through any translation. From there you can register Rosetta as a runtime and use it to run x86-64 Linux apps on ARM64 if you want. ( https://developer.apple.com/documentation/virtualization/run... )

I don't understand why one needs to emulate a virtual machine to run a container. Why do you need a kernel? Why emulate physical devices, interrupts and everything else? Why cannot one run a container as a protected mode application?

Because containers are at their heart a shorthand term for a bunch of Linux kernel features that do not exist on other OSes.

Re: LXD containers on macOS at near-native speeds

#66
post #42

Earlier quoted context omitted.

No, QEMU runs an ARM VM. Inside that VM, Rosetta for Linux can be used to run x86 executables, just like on macOS.

so arm macbooks are still problematic for developers who use containers and x86 servers... it's still surprising to me that they did this as i always got the sense that developer word of mouth helped drive a lot of macbook adoption in the 2000s.

Aside from the basis of your comment being not really true (as mrunkel commented), every thread about Apple Silicon Macs is full of people praising the performance and battery life. This is more positive word-of-mouth than Apple's had in years.

Re: LXD containers on macOS at near-native speeds

#67

Earlier quoted context omitted.

QEMU can use the MacOS virtualization framework layer to run a VM built for the same arch without going through any translation. From there you can register Rosetta as a runtime and use it to run x86-64 Linux apps on ARM64 if you want. ( https://developer.apple.com/documentation/virtualization/run... )

I don't understand why one needs to emulate a virtual machine to run a container. Why do you need a kernel? Why emulate physical devices, interrupts and everything else? Why cannot one run a container as a protected mode application?

Containers are just fancy Linux chroots. So you need a Linux OS.

Re: LXD containers on macOS at near-native speeds

#69
post #40

So is there some canonical guide to running a docker compose style app on Mac m1 machines that has good filesystem performance? It seems like there’s many ways to approach the topic now so it’s hard to tell which one is “winning”. I’d love to containerize all of my local development efforts (scripts and rails apps) but the slow ass filesystem always ruined it in the past.

Canonical has a product of their own: https://multipass.run/ They all use the underlying OS hypervisor so I’m not sure you can get perceivable performance out of one solution over the other.

Sometime it can be buggy on macOS and quite slow to boot with Ubuntu VM, wish there is a cloud VM image.

Re: LXD containers on macOS at near-native speeds

#70
post #11

This is part of the bigger Macpine project, which to me is much more interesting than LXD: https://github.com/beringresearch/macpine """ The goal of this project is to enable MacOS users to: Easily spin up and manage lightweight Alpine Linux environments. Use tiny VMs to take advantage of containerisation technologies, including LXD and Docker. Build and test software on x86_64 and aarch64 systems """

It feels like lima and colima are much more mature. Being unable to remap the SSH port (or other ports) alone makes this a non-starter.
Post reply on HN