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

Use SSH only without X11

shekohex opened this issue · comments

Great project, I have a use case where I need the VM with SSH only without GUI/X11 like in a CI/CD for example.
is that supported?
also for example, if I want to use this in Windows WSL 2 I had to install or configure X11, which in my use case isn't needed at all. is there an easier way?

Jump into the VNC folder and build that version :)

Edit for anyone reading https://github.com/sickcodes/Docker-OSX/blob/master/vnc-version/Dockerfile

I'll try that tonight :)

I'll close it now, if I needed something I'll reopen or make a new issue.

Hey, it's me again, I successfully installed it in docker in windows using WSL2 with KVM Enabled Kernel, it works and I'm using it from SSH most of the time.
But, is there is a way that I could skip this screen? it requires me to open vnc and choose the correct drive in my case it is called INTERNAL which is macOS is installed.
I need when the container started up it choose it automatically or with timeout as we used in normal Hackintosh setup.
Here a screenshot of what I'm talking about.
vnc macos windows

I found #53 to be related to my comment above, I used Open Core Configurator to mount the EFI and edit the config.plist from #53 but seems that nothing changed, and nothing has been saved, am I missing something?

UPDATE:
I tried to restart without shutting down, and it worked but If I turned off the container and turned it on again any changes is get deleted! is that mean that I'm editing on a RO file?

@shekohex did you check your stopped containers? (docker ps -a)

I just had to start the container with docker start $containerName.

@daraul Hey, I'm using a docker-compose.yml file

version: '3.4'

services:
  osx:
    container_name: osx
    build:
      context: .
      dockerfile: Dockerfile
    image: docker-osx-vnc
    privileged: true
    environment:
      - RAM=4
      - CORES=4
      - CPU=4
    ports:
      - '50922:10022'
      - '8888:5999'
    cap_add:
      - ALL
    volumes:
      - ~/.data/osx:/mnt/host

and I use docker-compose start osx or docker-compose stop osx

I'm not sure why the container might have been reset, then. That's unusual.

I'm not sure why the container might have been reset, then. That's unusual.

My data is saved, everything is saved my Apple ID and my settings, only changes to EFI get reset on every boot or should I say when container startup.

Oh! Well I'd say that makes sense, but only because I don't know how any of that might be configured in the docker-compose file. I figure that's all in the ~/.data/osx folder?

I figure that's all in the ~/.data/osx folder?

Nothing got copied to/from ~/.data/osx and I don't know why!

Hey mate did you get back into the container? If so feel free to close the issue :)

@shekohex Hi, I'm trying to use your docker-compose.yml file with the official Dockerfile file and pulling the latest docker-osx.
I ran into some errors. Here's the full output. Can you help? I know very little of docker, so if you can explain in detail it's better for me.
PS C:\Projects\macos> docker-compose up osx
[+] Running 2/2

  • Network macos_default Created 0.1s
  • Container osx Created 0.1s
    Attaching to osx
    osx | ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
    osx | ++ id -u
    osx | ++ id -g
    osx | + sudo chown 1000:1000 /dev/kvm
    osx | _XSERVTransmkdir: Mode of /tmp/.X11-unix should be set to 1777
    osx | _XSERVTransmkdir: this may cause subsequent errors
    osx | _XSERVTransSocketCreateListener: failed to bind listener
    osx | _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
    osx | _XSERVTransMakeAllCOTSServerListeners: failed to create listener for unix
    osx |
    osx | Xvnc TigerVNC 1.12.0 - built Nov 13 2021 18:03:45
    osx | Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)
    osx | See https://www.tigervnc.org for information on TigerVNC.
    osx | Underlying X server release 12009000, The X.Org Foundation
    osx |
    osx |
    osx | Wed Jan 5 04:27:23 2022
    osx | vncext: VNC extension running!
    osx | vncext: Listening for VNC connections on all interface(s), port 5999
    osx | vncext: created VNC server for screen 0
    osx | ++ id -u
    osx | ++ id -g
    osx | + sudo chown -R 1000:1000 /dev/snd
    osx | + true
    osx | + [[ 4 = max ]]
    osx | + [[ 4 = half ]]
    osx | ++ id -u
    osx | ++ id -g
    osx | + sudo chown -R 1000:1000 /dev/snd
    osx | + true
    osx | + exec qemu-system-x86_64 -m 4000 -cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check, -machine q35,accel=kvm:tcg -smp 4,cores=4 -usb -device usb-kbd -device usb-tablet -device 'isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc' -drive if=pflash,format=raw,readonly=on,file=/home/arch/OSX-KVM/OVMF_CODE.fd -drive if=pflash,format=raw,file=/home/arch/OSX-KVM/OVMF_VARS-1024x768.fd -smbios type=2 -audiodev alsa,id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda -device ich9-ahci,id=sata -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2 -device ide-hd,bus=sata.2,drive=OpenCoreBoot -device ide-hd,bus=sata.3,drive=InstallMedia -drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=qcow2 -drive id=MacHDD,if=none,file=/home/arch/OSX-KVM/mac_hdd_ng.img,format=qcow2 -device ide-hd,bus=sata.4,drive=MacHDD -netdev user,id=net0,hostfwd=tcp::10022-:22,hostfwd=tcp::5900-:5900, -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:09:49:17 -monitor stdio -boot menu=on -vga vmware
    osx | QEMU 6.2.0 monitor - type 'help' for more information
    osx | (qemu) ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
    osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
    osx | ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
    osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
    osx | ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
    osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    osx | ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
    osx | alsa: Reason: No such file or directory
    osx | ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
    osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
    osx | ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
    osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
    osx | ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
    osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    osx | ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
    osx | ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
    osx | alsa: Could not initialize DAC
    osx | alsa: Failed to open default': osx | alsa: Reason: No such file or directory osx | audio: Failed to create voice dac'
    osx | ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
    osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
    osx | ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
    osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
    osx | ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
    osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    osx | ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
    osx | ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
    osx | alsa: Could not initialize ADC
    osx | alsa: Failed to open default': osx | alsa: Reason: No such file or directory osx | ALSA lib confmisc.c:855:(parse_card) cannot find card '0' osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory osx | ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory osx | ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name osx | ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory osx | ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory osx | ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default osx | alsa: Could not initialize ADC osx | alsa: Failed to open default':
    osx | alsa: Reason: No such file or directory
    osx | audio: Failed to create voice `adc'

Yeah I've started seeing that same problem lately. Been trying to figure out how to get past that. It was working flawlessly until recently. Not sure if some Windows update broke this.

EDIT: just realized those alsa errors are normal. Basically, the container just hangs for me after printing those alsa error messages. There are no other error messages before the alsa ones print. I think I'll open a new issue for what I am seeing.

EDIT2: Never mind. It just started working again. I mean the problem was that when I tried to attach the Spice remote viewer, the Spice viewer window would not activate. Before it just started working again for me, I re-ran all the prereq commands and also did a bunch of other things all in an attempt to get things working again. Sad thing is I didn't realize the alsa errors were normal until much later and so I was running a bunch of commands and trying to start the container hoping for those errors to go away. The very last thing I did do was remove the naked container image that I was using and pulled it down again because I noticed there was an issue with a recent update that was rolled back. Maybe that fixed it? 🤷‍♂️

I think the answer for anybody finding this issue is using the naked tag: sickcodes/docker-osx:naked