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.1k stars 1.78k forks source link

OSX_COMMANDS vs command in terminal #492

Open manang opened 2 years ago

manang commented 2 years ago

Hi, I'm trying to use OSX_COMMANDS to execute a script. this is my command:

DOCKER_OSX_QEMU_BIGSUR_IMAGE_PATH=/home/jenkins/docker-osx/mac_hdd_ng_auto_big_sur.img
docker run -i \
    --name ios-toolchain-build \
    --device /dev/kvm \
    -p 50922:10022 \
    -v "${SHARE}:/mnt/hostshare" \
    -e "OSX_COMMANDS=/bin/zsh -c \"echo alpine | sudo -S mount_9p hostshare && ls /Volumes/hostshare/ &&  /Volumes/hostshare/ci/build.sh \"" \
    -e EXTRA="-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=user" \
    -v "${DOCKER_OSX_QEMU_BIGSUR_IMAGE_PATH}:/image" \
    sickcodes/docker-osx:naked-auto

but if I run the command via ssh, the outcome is different, I have different variables

this is the way I run the container

DOCKER_OSX_QEMU_BIGSUR_IMAGE_PATH=/home/jenkins/docker-osx/mac_hdd_ng_auto_big_sur.img
docker run -i \
    --name ios-toolchain-build \
    --device /dev/kvm \
    -p 50922:10022 \
    -v "${SHARE}:/mnt/hostshare" \
    -e "OSX_COMMANDS=/bin/zsh -c \"echo alpine | sudo -S mount_9p hostshare && ls /Volumes/hostshare/ &&  /Volumes/hostshare/ci/build.sh \"" \
    -e EXTRA="-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=user" \
    -v "${DOCKER_OSX_QEMU_BIGSUR_IMAGE_PATH}:/image" \
    sickcodes/docker-osx:naked

why does it happen? the qemu is the same. The problem is that in the second case it works well, in the first case I obtain an error and I don't undersand why Thanks a lot

Angelo

sickcodes commented 2 years ago

Try this for sharing instead, it eats the mount_9p alive:

mkdir ~/mnt/osx
sshpass -p alpine sshfs user@localhost:/ -p 50922 ~/mnt/osx
danrossi commented 1 year ago

ssh / sftp works via that forwarded port. But win ssh fails to work with a port added. It's broken

\\sshfs.r\danielr@localhost!50922/