sickcodes / Docker-OSX

Run macOS VM in a Docker! Run near native OSX-KVM in Docker! X11 Forwarding! CI/CD for OS X Security Research! Docker mac Containers.

Home Page:https://hub.docker.com/r/sickcodes/docker-osx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: is this compatible with Windows 10?

ningacoding opened this issue · comments

is this compatible with Windows 10?

(the question is because https://github.com/kholia/OSX-KVM docs talks about running on Linux only.)

anyway i'm trying right now xD

also i'll try on a WSL2 Ubuntu instance (if Windows fails).

Let me know if it worked. I'm interested in the results.

did you use WSL2? and how were you able to set up the GUI for it please?

@sickcodes thanks, when using WSL/2 virtualbox does not works.

This will probably work.

https://sourceforge.net/projects/vcxsrv/

  • Install VcXsrv on windows and start it up.
  • Install x11-apps in your WSL/2
# WSL/2 
sudo apt-get install x11-apps
DISPLAY=:0.0 xclock

It should open on your Windows desktop (to verify that X11 is working)

Then you should be able to run the normal docker command at the top of the readme :)

Unless nested virtualization is not enabled on WSL/2

Credit angellus:
https://www.reddit.com/r/bashonubuntuonwindows/comments/apm0vx/comment/egacocz

did you use WSL2? and how were you able to set up the GUI for it please?

Yes, i'm using WSL2, im using X410 for GUI but you can use a free alternative, i'll add steps to make it run all Docker-OSX on next comment.

if you wish to use X410 install from Microsoft Store, then:

  • Start a Linux WSL instance
  • edit bash running
    sudo nano ~/.bashrc (enter your sudo password)
  • add this to the last line (so you dont have to add DISPLAY=X to every start app)
    export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
  • Allow Public Access from Windows System Tray Icon
    image
  • Exit and Enter from the WSL instance then Run a GUI app from WSL instance for example:
    gedit&

IMPORTANT NOTE: Check your Firewall of Windows or Antivirus blocking ports to x410 (x server) and allow them

This should work.

These are fantastic infos, thank you. I'll test them asap:)

@ningacoding so you got it working fine?

Even better you could add the Arch Linux WSL and just enter the commands in from the Dockerfile

I got Ubuntu, WSL 2, XLaunch working well. Where do I go from there?

@ningacoding @sickcodes
Thanks for the great information.
I tried to configure WSL2(Ubuntu) and VcXsrv, but I got an error when executing the following command.

$docker run --privileged -e "DISPLAY=${DISPLAY:-:0.0}" -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize kvm: No such file or directory

$sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager
$sudo systemctl enable libvirtd.service
$sudo systemctl enable virtlogd.service
$sudo modprobe kvm
modprobe: FATAL: Module kvm not found in directory /lib/modules/4.19.84-microsoft-standard

Have you made any other changes to your WSL?
After doing a little research, I realized that I may have to rebuild the wsl kernel, did you do that?

Also stuck there :/
Apparently WSL never wanted to support virtualization.

Edit: ok so on this thread:

microsoft/WSL#4193

The latest fast build of windows is supposed to include kvm installed (for Intel)

WSL2 virtualization is supported:

Add a file at C:\Users\<username>\.wslconfig

with content:

[wsl2]
nestedVirtualization=true

Restart WSL2 with:

wsl --shutdown
wsl

Check if your Kernel supports kvm (newer WSL2 kernels does), with kvm-ok

image

install kvm-ok if prompt to install.

After those steps you should be able to Install Docker and Docker-OSX with Containers over containers:
Windows>Ubuntu18.04>Docker>Arch>MacOs

Thanks so much!

Edit: Ok kvm is up and running! I did need to update to the latest preview build for windows.

Confirm, launched. Little bit laggy and WSL starts using 16G of ram

Confirm, launched. Little bit laggy and WSL starts using 16G of ram

The problem with WSL it's the ausence of GPU and the problem with QEMU you can't choose a better CPU (the cpu of this repository is Core 2 Duo :/ )

I'm currently on Windows Pro 21H1 (Build 19043.985) and I can't get kvm to work. sudo kvm-ok always outputs:

INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used

After reading https://boxofcables.dev/accelerated-kvm-guests-on-wsl-2/ and https://dev.to/nicole/running-macos-on-windows-10-with-wsl2-kvm-and-qemu-21e1 it looks like I need to join Windows insider and update my Windows to the dev channel. Is this right? Is there any way around this?

Reading the comments here it looks like it should work with my version, but I'm not sure. I can't get it to work.
Any ideas?

I tried 5.4.72-microsoft-standard-WSL2 and 5.10.16.3-microsoft-standard-WSL2, both didn't worked.

I appreciate any help.

KVM at least works on the newest dev builds including Windows 11.

After following the superb https://boxofcables.dev/accelerated-kvm-guests-on-wsl-2/ and compiling a few kernels both KVM module and builtin I find KVM still does not work with Ubuntu/Microsoft 5.10.43.3 and Windows (Home64) 21H1 19043.1165

Perhaps there are settings within Windows that determine how it treats hypervisors or VM?

Edit: /sys/module/kvm_intel/parameters/nested actually shows Y

does it works for AMD?

does it works for AMD?

I got it working on my Zephyrus laptop
AMD Ryzen 9 5900HS

Edition Windows 11 Pro Insider Preview
OS build 22489.1000

.wslconfig
[wsl2]
memory = 8GB # Limits VM memory in WSL 2 to 4 GB
processors = 6 # Makes the WSL 2 VM use two virtual processors
nestedVirtualization = true
kernelCommandLine = amd_iommu = on iommu = pt kvm.ignore_msrs = 1 kvm-amd.nested = 1 kvm-amd.ept = 1 kvm-amd.emulate_invalid_guest_state = 0 kvm-amd.enable_shadow_vmcsd = 1 kvm-amable_vmcsd = 1 kvm-amable_vmcsd = 1 kvm-amd.