mirror of
https://github.com/sickcodes/Docker-OSX.git
synced 2026-01-11 21:10:25 +01:00
Virtualization inside the OSX VM #313
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @saied89 on GitHub (Jan 26, 2022).
I can't run android emulator inside the vm with android studio complaining that "Your CPU does not support VT-x"
I think it might be due to the virtual cpu that is set.
When I run
sysctl -n machdep.cpu.brand_stringfrom here it reports a core 2 Dou Penryn which surely doesn't support VT-x.Is is possible to set a more up to date virtual cpu for the vm?
@sickcodes commented on GitHub (Jan 27, 2022):
I think we need to try
qemu-system-x86_64 -M accel=hvf --cpu hostor somethingDoes the iPhone simulator work?
@saied89 commented on GitHub (Jan 27, 2022):
yes the iPhone simulator works
@saied89 commented on GitHub (Jan 30, 2022):
If we add these and build a new docker image, can it handle an existing mac disk image or do we need to create a new one from scratch?
@sickcodes commented on GitHub (Feb 8, 2022):
You can always use existing images, in fact, you can change serial numbers on an existing machine.
@arsinclair commented on GitHub (Mar 3, 2022):
I need to install and run docker inside of an running OSX image. When I start docker, it reports that
the hardware is incompatible with Docker Desktop, a problem which I think is kinda similar to the one in question.Is there anything that can be done in order to make it work?
sysctl kern.hv_supportreports0.@julianxhokaxhiu commented on GitHub (Dec 9, 2022):
I just landed on the same issue as we speak. I'm currently running this stack on top of WSL, everything works fine, but when trying to run Lima the Qemu machine inside refuses to work. Is there a way I can workaround this even without waiting for an offical patch to come up?
//EDIT: Regarding the how I found we can pass an
EXTRAenv var to the container, now I need to figure out which is the right set of flags to pass to enable the nested virtualization.//EDIT2: I see the image by default assigns the
kvm:tcgaccelerators via the KVM env var. Maybe enablinghvfis enough? Although on my own Arch system when I install qemu and run the help command this is the output I get:Is
hvfsupported on the binary provided in this container?//EDIT3: Ok scratch that,
hvfis supposed to be used on Apple Host machines. So what is missing to correctly allow nested virtualization inside macOS itself? 🤔//EDIT4: I was successfully able to get nested virtualization by simply passing these two ENV vars to the container!
Tested on an Intel i7-8550U machine that runs Arch with KDE/Wayland and it works 🎉
sysctl kern.hv_supportnow returns1and lima VMs can be successfully started.I'll test it later on WSL on Win11 which runs on an AMD Ryzen 7 5800H.
@sickcodes commented on GitHub (Dec 11, 2022):
That's awesome thank you. Do you want to submit a PR to update the docs? I can otherwise
@julianxhokaxhiu commented on GitHub (Dec 11, 2022):
You're welcome :) Feel free as I'd have no idea where to put it at the moment. Thanks for all the great work you've put around this project!
Oh forgot to mention that unfortunately this method does NOT work on AMD CPUs as QEmu needs to pass the CPU capabilities 1:1 and VMX is not a supported extension on AMD CPUs. This is why this method works only on Intel CPUs.
I did try to do a bit of research regarding emulating this extension on AMD CPUs but unfortunately I wasn't able to find anything useful. In case you do please let me know!