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
46.2k stars 2.47k forks source link

using docker-compose #751

Closed vespino closed 5 months ago

vespino commented 6 months ago

The following command creates a container that I can use via VNC:

docker run -i --device /dev/kvm --name=docker-osx -p 50922:10022 -p 5999:5999 -e "DISPLAY=${DISPLAY:-:0.0}" -e GENERATE_SPECIFIC=true -e DEVICE_MODEL="iMacPro1,1" -e SERIAL="C02YR6YYHX87" -e BOARD_SERIAL="C027251024NJG72UE" -e UUID="5CCB366D-9118-4C91-A00E-E5BEF3BED451" -e MAC_ADDRESS="E8:5C:2C:9F:46:2E" -e EXTRA="-display none -vnc 0.0.0.0:99,password=off" sickcodes/docker-osx:ventura

Using composerize.com I have converted this to a docker-compose.yml file:

services:
    docker-osx:
        stdin_open: true
        devices:
            - /dev/kvm
        container_name: docker-osx2
        ports:
            - 50923:10022
            - 5998:5999
        environment:
            - DISPLAY=${DISPLAY:-:0.0}
            - GENERATE_SPECIFIC=true
            - DEVICE_MODEL=iMacPro1,1
            - SERIAL=C02YR6YYHX87
            - BOARD_SERIAL=C027251024NJG72UE
            - UUID=5CCB366D-9118-4C91-A00E-E5BEF3BED451
            - MAC_ADDRESS=E8:5C:2C:9F:46:2E
            - EXTRA="-display none -vnc 0.0.0.0:199,password=off"
        image: sickcodes/docker-osx:ventura

When running docker-compose up however it stops with the following output:

docker-osx2  | qemu-system-x86_64: -vnc 0.0.0.0:199,password=off": Parameter 'password' expects 'on' or 'off'
docker-osx2 exited with code 1

When removing the double quotes from EXTRA="-display none -vnc 0.0.0.0:199,password=off" container creation stops at:

docker-osx2  | alsa: Reason: No such file or directory
docker-osx2  | audio: Failed to create voice `adc'

At this point I can’t use it using VNC.

Any thoughts?

alexjfinch commented 5 months ago

This might not be the issue but I can see your docker-compose file has port 199 instead of 99 for VNC - its the only differences I can see between the two.

Otherwise I'd remove it and then try - VNC_NO_PASSWORD: 1 as another environment variable.

What distribution are you using and are you using X11 or Wayland?

vespino commented 5 months ago

Where it went wrong for me, was the changes in ports I tried to make in an attempt of running a second container next to a running one. I removed the first container (the one created with the docker command), made changes to the docker compose file, and it then runs fine. I'm now setting up MacOS via VNC.