Live data from Hacker News

macOS in QEMU in Docker

github.com

1–10 of 190 posts

Re: macOS in QEMU in Docker

#3
More info on the project in this reddit thread from a few hours back:

https://www.reddit.com/r/jailbreak/comments/gwg3e4/free_rele...

The developer mentions[0] that, like macOS-Simple-KVM[1], this leverages kholia's OSX-KVM[2].

[0] https://www.reddit.com/r/jailbreak/comments/gwg3e4/free_rele...

[1] https://github.com/foxlet/macOS-Simple-KVM

[2] https://github.com/kholia/OSX-KVM

Re: macOS in QEMU in Docker

#4
Edit: Okay, I understand my assumption was wrong. Thanks

Doesn't docker run a container in a single thread? So this would be running the entire MacOS in a single thread? Is there a way to tell Docker to execute this in multiple threads?

Re: macOS in QEMU in Docker

#5

Edit: Okay, I understand my assumption was wrong. Thanks Doesn't docker run a container in a single thread? So this would be running the entire MacOS in a single thread? Is there a way to tell Docker to execute this in multiple threads?

> doesn't docker run a container in a single thread?

No, it doesn't.

Re: macOS in QEMU in Docker

#7

Edit: Okay, I understand my assumption was wrong. Thanks Doesn't docker run a container in a single thread? So this would be running the entire MacOS in a single thread? Is there a way to tell Docker to execute this in multiple threads?

Nobody would be using docker is that was the case. Spawn as many processes and threads as you want.

Re: macOS in QEMU in Docker

#8
So this is pretty misleading. It's really a full system emulator (qemu) running inside Docker, using root privileges on the container that make the isolation very weak (--privileged).

It also uses hardware assisted virtualization (KVM) which is not going to be available most of the time Docker is.

You can think of the Docker platform itself as subset of the Linux platform. With many common features removed by default... SYS_PTRACE, cgroups come to mind as not allowed within the container. (This "Docker as a subset of Linux" is also what you end up getting from most "Docker as a service" platforms offered by clouds, including kubernetes. I'm referring to AWS Fargate, Google Cloud Run, GKE, AKS, here.)

So don't think of this as macOS in docker wherever docker runs.

What would be a lot more analogous to macOS in docker would be running Darling in docker: https://www.darlinghq.org/ ... if that could be made to work for the entire system (highly unlikely)

Darling is more like Wine in that it runs native executables for one platform as native processes on another platform using a compatibility layer. Wine, by the way, definitely works quite well inside Docker.

Also, one final thought. I wonder if you could get macOS to boot in QEMU without hardware assisted virtualization. Then you could probably run this in a fully isolated container again. The performance would likely be abysmal though!

Re: macOS in QEMU in Docker

#9

Edit: Okay, I understand my assumption was wrong. Thanks Doesn't docker run a container in a single thread? So this would be running the entire MacOS in a single thread? Is there a way to tell Docker to execute this in multiple threads?

No, that isn't how containers work. Containers run processes, as many as you want, each which can use as many threads as they (up to ulimits). Most hypervisors will allocate 1 thread per virtual CPU core by default, and since this is using qemu with KVM then that's likely the case.

Looking at the Dockerfile in the OP, you can see it's using https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Boot.... as the script to start the VM, and you can see the -smp 4,cores=2 in the qemu arguments which configures how many threads/cores/sockets to assign to the guest. Though I'm not entirely familiar with the syntax so I'm not sure what the "4" is for, but I'd guess threads.

Re: macOS in QEMU in Docker

#10
post #7

Edit: Okay, I understand my assumption was wrong. Thanks Doesn't docker run a container in a single thread? So this would be running the entire MacOS in a single thread? Is there a way to tell Docker to execute this in multiple threads?

Nobody would be using docker is that was the case. Spawn as many processes and threads as you want.

A wild WASM appears.

I joke but you get it.

Post reply on HN