3 ms·
A Linux VM is still needed because these are Linux containers, ie. they need namespaces, cgroups, layered rootfs, etc.
by vocram 6y ago
A Linux VM is still needed because these are Linux containers, ie. they need namespaces, cgroups, layered rootfs, etc.
- mbreese 6y agoOf course, but my question is how is it created... MacOS has a Hypervisor framework for creating VMs, which Docker is using. But I don’t know enough about those internals to understand how they are getting an x86 VM on an ARM host. I know it can be done with qemu emulation, but does that still need the MacOS hypervisor framework or does it run as a normal user process? These are the questions I’m trying to figure out...
- cpuguy83 6y agoThe VM is an arm64 VM.
- sirn 6y ago(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-misc.html https://www.kernel.org/doc/html/latest/admin-guide/binfmt-mi... [2]: https://github.com/multiarch/qemu-user-static https://github.com/multiarch/qemu-user-static
- mbreese 6y agoStep 4 was what I was missing.