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.
https://hub.docker.com/r/sickcodes/docker-osx
GNU General Public License v3.0
36.13k stars 1.78k forks source link

Amazon Linux problems... #68

Open AlexMcConnell opened 3 years ago

AlexMcConnell commented 3 years ago

Well, it's Amazon's own special implementation of Linux, so who knows if it's even possible to make this work, but...

SSH'd into my EC2 instance.

Ran:

sudo yum install libvirt qemu-kvm -y
sudo systemctl enable libvirtd.service
sudo systemctl enable virtlogd.service
sudo modprobe kvm

Exited and rebooted.

SSH'd back in, pulled the Docker image and ran: docker run --privileged -e "DISPLAY=${DISPLAY:-:0.0}" -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx

Failboat:

ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
Unable to init server: Could not connect: Connection refused
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize kvm: No such file or directory

Other stuff:

$ egrep -c '(svm|vmx)' /proc/cpuinfo
0
$ ls -l /dev/kvm
ls: cannot access /dev/kvm: No such file or directory
$ pgrep -a X
$ echo $SHELL
/bin/bash
$ echo $DISPLAY

$

Is this due to not having a display? Is there a way around not having a display?

daraul commented 3 years ago

I'm having this problem with the VNC version as well.

sickcodes commented 3 years ago

99% chance that they do not support hardware nested virtualization

sickcodes commented 3 years ago

Amazon Linux is actually Red Hat linux, so it will work.... but in this case, it's probably hardware nested virtualization that has been disabled.

Digital Ocean works

daraul commented 3 years ago

I can confirm Digital Ocean works, I'm using that as I type this comment, but don't expect to use xcode. Apple blocks requests from DO droplets.

Not sure if/how I can enable hardware nested virtualization on AWS, but I'll definitely have a closer look at their RHEL AMIs

sickcodes commented 3 years ago

I can confirm Digital Ocean works, I'm using that as I type this comment.

Not sure if/how I can enable hardware nested virtualization on AWS, but I'll definitely have a closer look at their RHEL AMIs

Haha excellent! 😝🚀🚀

LcTrKiD commented 3 years ago

Is it expensive in DO? I want to have macOS ephimeral runners for my Gitlab CI/CD but an AWS metal instance is pretty much for my use case...

sickcodes commented 3 years ago

The most economical way to do it is in the following way:

docker commit at the stage you want your machine, or copy the .img to somewhere.

Then use their API, or terraform, to run the server for the time required, and then delete it after.

sickcodes commented 3 years ago

Is it expensive in DO? I want to have macOS ephimeral runners for my Gitlab CI/CD but an AWS metal instance is pretty much for my use case...

I am not familiar with their bare metals but it would probably work.

ykhandelwal913 commented 3 years ago

@daraul were you able to run it on amazon linux?

sickcodes commented 3 years ago

@daraul were you able to run it on amazon linux?

@ykhandelwal913 it will run on bare metal only, source: https://www.reddit.com/r/aws/comments/eo85jr/ec2_instance_types_that_support_nested/

Edit: this thread could be old news though

ykhandelwal913 commented 3 years ago

Thanks @sickcodes for prompt response. sorry for reopening the old thread.

daraul commented 3 years ago

I never got a chance to look at their RHEL AMI's @ykhandelwal913, but if I do I'll be back.

iambenmitchell commented 3 years ago

If you are in the EU, Hetzner is a great host to use. They have servers in Germany and Finland. Super cheap prices. I have 10Gbps connection for €39 p/m (not including the server cost)