Now, this might not work, as I'm not sure Rosetta covers all of the x86 instructions/settings that qemu would need, so you might be stuck with ARM64 qemu emulating x86 anyway.
It's possible to run qemu without Hypervisor.framework, but that means it's doing its own second layer of translation. This would be horribly inefficient under Rosetta.
That said, assuming Qemu runs entirely in user space I would expect it to be able to run under rosetta, and am genuinely curious if it does, and what the perf is - as I said, I would expect it to be much slower than arm64 qemu emulating x86_64, but I'm curious as to how much.
https://developer.apple.com/documentation/apple_silicon/abou...
> What Can't Be Translated?: Virtual Machine apps that virtualize x86_64 computer platforms
(How you mention it would be the simplest possible thing that would work)
These are the questions I’m trying to figure out...
(5) Docker Image (amd64)
^
|
(4) QEMU Binfmt (arm64 <-> amd64 binary emulation layer)
^
|
(3) Linux VM (arm64)
^
|
(2) Hypervisor.framework (arm64, macOS native virtualization framework)
^
|
(1) Docker for Mac
Linux Kernel has a feature to allow using a wrapper to execute userspace program based on file header (binfmt[1]). In this case, Linux VM in (3) has QEMU user mode emulation registered as binfmt, so any amd64 binaries are automatically wrapped into `qemu-x86_64-static /path/to/bin` and run. Docker Image itself doesn't run a Linux kernel but use one from the VM host, so this scenario is possible.This is also how multiarch[2] works (for amd64 to arm64/ppc64le/etc.) which might even be what Docker is using. In case of multiarch, the qemu-*-static binary is provided as a container running in privileged mode.
[1]: https://www.kernel.org/doc/html/latest/admin-guide/binfmt-mi...