Docker-OSX
Docker-OSX copied to clipboard
Folder shared via volume not mounted in mac
NAME="Linux Mint"
PRETTY_NAME="Linux Mint 20.1"
VERSION_CODENAME=ulyssa
UBUNTU_CODENAME=focal
QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.19)
libvirtd (libvirt) 6.0.0
free: Multiple unit options doesn't make sense.
8
16
crw-rw----+ 1 root kvm 10, 232 Jan 28 10:45 /dev/kvm
total 16K
drwxrwxrwt 2 root root 4.0K Jan 26 16:30 .
drwxrwxrwt 21 root root 12K Jan 28 11:03 ..
srwxrwxrwx 1 root root 0 Jan 26 16:30 X0
root 2147 0.9 0.2 2344676 45424 ? Ssl Jan26 25:11 /usr/bin/dockerd -H unix://
myuser 240658 0.0 0.0 9044 2496 pts/8 S+ 11:04 0:00 grep --color=auto dockerd
6d1ae75fa7b8 sickcodes/docker-osx:monterey "/bin/bash -c 'sudo …" 20 minutes ago Up 20 minutes 0.0.0.0:50922->10022/tcp, :::50922->10022/tcp serene_cori
kvm:x:108:
docker:x:1501:myuser
libvirt:x:138:myuser
libvirt-qemu:x:64055:libvirt-qemu
libvirt-dnsmasq:x:139:
Hello @sickcodes,
I followed the instructions at https://github.com/sickcodes/Docker-OSX#share-folder-with-docker-osx-qemu-macos to mount some documents inside the mac. Unfortunately, the folder I share via volume is not found on the mac.
First I downloaded the catalina from https://images2.sick.codes/mac_hdd_ng_auto.img. I also downloaded the full pre-installed catalina image, and both the big-sur and monterey image. For the big-sur and monterey, I run the container to erase the disk then proceed to the installation. Once done, I copied the mac_hdd_ng.img from the installed docker images in /var/lib/docker to a folder owned by my user. By the way, my user has a UID=1500, and the copied images are owned by 1000:1000 user.
So I have the following images:
- mac_hdd_ng_big_sur.img
- mac_hdd_ng_monterey.img
- mac_hdd_ng_auto.img
For each images I tried the following without success:
SHARE=/path/myfolder
# OSX_IMAGE=/path/mac_hdd_ng_auto.img
# OSX_IMAGE=/path/mac_hdd_ng_monterey.img
OSX_IMAGE=/path/mac_hdd_ng_big_sur.img
# Attempt 1 - NAKED -> works
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v "${OSX_IMAGE}:/image" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v "${SHARE}:/mnt/hostshare" \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e EXTRA="-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=hostshare" \
-e GENERATE_UNIQUE=true \
-e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist \
sickcodes/docker-osx:naked
# Attempt 2 - AUTO -> works but have to sudo -S mount_9p manually
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v "${OSX_IMAGE}:/home/arch/OSX-KVM/mac_hdd_ng.img" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v "${SHARE}:/mnt/hostshare" \
-e OSX_COMMANDS="echo alpine | sudo -S mount_9p hostshare && /bin/bash" \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e EXTRA="-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=hostshare" \
sickcodes/docker-osx:auto
# Attempt 3 - AUTO -> works but have to sudo -S mount_9p manually
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v "${OSX_IMAGE}:/home/arch/OSX-KVM/mac_hdd_ng.img" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v "${SHARE}:/mnt/hostshare" \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e OSX_COMMANDS="echo alpine | sudo -S mount_9p hostshare && /bin/bash" \
-e EXTRA="-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=hostshare" \
-e GENERATE_UNIQUE=true \
-e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist \
sickcodes/docker-osx:naked
Any idea?
Also is it correct that:
- when using the auto image, I have to bind mount
-v "${OSX_IMAGE}:/home/arch/OSX-KVM/mac_hdd_ng.img"? - when using the naked image, I have to bind mount
-v "${OSX_IMAGE}":/image? - with the auto image, it should auto mount at start thanks to OSX_COMMANDS ?
Unrelated question: after the macos installation, I want to configure the system a bit and do some more installation. To copy the image from the /var/lib/docker, should I dot it while the guest is still up and running, or I have to shut down first then copy the image? Because the options I change in system preferences (like keyboard or mouse settings) are not saved between docker run. Also, is it possible to install directly the big sur os inside Dockerfile or I have to download your image first then do the installation manually before copying the image to use it in the naked image?
Thank you in advance
EDIT:
I don't exactly what I did but after a host reboot I can share the folder manually sudo -S mount_9p hostshare with the naked image.
I still can't automatically mount with the auto image.
Auto image might need a reset NVRAM since it didn't have a volume when it was made. It's quite an old image, should still works, but Monterey is the best one to use at the moment.