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
45.38k stars 2.4k forks source link

more detailed info on how to get a persistent sonoma container? #797

Open ParsaGachkar opened 3 weeks ago

ParsaGachkar commented 3 weeks ago
Linux NL-Regus-parsa 6.8.0-40-generic #40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

1
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        49G   38G  8,9G  81% /
Command 'qemu-system-x86_64' not found, but can be installed with:
sudo apt install qemu-system-x86      # version 1:6.2+dfsg-2ubuntu6.22, or
sudo apt install qemu-system-x86-xen  # version 1:6.2+dfsg-2ubuntu6.22
Command 'libvirtd' not found, but can be installed with:
sudo apt install libvirt-daemon
               total        used        free      shared  buff/cache   available
Mem:            15Gi       1,1Gi        13Gi        54Mi       1,2Gi        14Gi
Swap:          2,0Gi          0B       2,0Gi
10
10
crw-rw----+ 1 root kvm 10, 232 aug 19 15:50 /dev/kvm
total 40K
drwxrwxrwt  2 root root 4,0K aug 19 15:55 .
drwxrwxrwt 23 root root  32K aug 19 15:56 ..
srwxrwxrwx  1 user user    0 aug 19 15:55 X1
root        7509  0.6  0.4 2503844 75520 ?       Ssl  15:56   0:00 /usr/bin/dockerd --config-file /etc/docker/daemon.json
user        7925  0.0  0.0   9216  2560 pts/0    S+   15:56   0:00 grep --color=auto dockerd
kvm:x:109:
docker:x:999:user

I was not able to get a persistent Sonoma container can anyone that have been able to achieve this guide me? here is my approach according to docs, I might be wrong!

# get a fresh container

# setup my appleid and install x-code
423  sudo  docker run -it     --device /dev/kvm     -p 50922:10022     -v /tmp/.X11-unix:/tmp/.X11-unix     -e "DISPLAY=${DISPLAY:-:0.0}"     -e GENERATE_UNIQUE=true     -e CPU='Haswell-noTSX'     -e CPUID_FLAGS='kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on'     -e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom-sonoma.plist'     sickcodes/docker-osx:sonoma

# successfully logged in into sonoma and everything seems to be working fine
# setup homebrew and xcode
# install nodejs
# shutdown container
# find a +10g image named "mac_hdd_ng.img" in docker folder and copy it to another place
 sudo find ~/disk/docker/ -name mac_hdd_ng.img -size +10G

 sudo cp /home/user/disk/docker/overlay2/e00e5cc77bbf0a3a58ca66712f1e8de24c0e018c42ec93ec48394615262f8167/diff/home/arch/OSX-KVM/mac_hdd_ng.img ~/disk

# try to run the container with the disk
sudo docker run -it     --device /dev/kvm     -p 50922:10022     -v "/home/user/disk/mac_hdd_ng.img:/image"     -v /tmp/.X11-unix:/tmp/.X11-unix     -e "DISPLAY=${DISPLAY:-:0.0}"     -e GENERATE_UNIQUE=true     -e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist     sickcodes/docker-osx:naked

And I get into an endless boot-loop, boot picker and an apple support screen with not-allowed (🚫) icon!

note: everything is fine until i try to persist the state of container

ParsaGachkar commented 3 weeks ago

ok i've got this working by committing the Sonoma container first then use the image from committed container! yet still ssh and no-picker options for naked-auto are still nonfunctional