Docker-OSX icon indicating copy to clipboard operation
Docker-OSX copied to clipboard

Copy files from Host into container User Folder ?

Open mhabsaoui opened this issue 4 years ago • 6 comments

Hi,

Just wanted to know if possible to mount host files into running docker container, e.g. inside the directory "/Users/$USER/Documents" ?

Of course the the -v volume option is made for that, but when going through docker container content ( docker exec -it docker-osx bash ), I don't seem to find my $USER home folder...

Is there anay Copy/Paste from Host to OSX setting on the Machine (like with virtuqlbox) ?

image

Thanks for feedback...

mhabsaoui avatar Apr 12 '21 10:04 mhabsaoui

Try over network

scp -P 50922 file.pdf user@localhost:/Users/user/Documents

Or by sharing a directory between you and the OSX

# stat mac_hdd_ng.img
SHARE=/home/user/test/1px/

docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -v "${PWD}/mac_hdd_ng.img:/home/arch/OSX-KVM/mac_hdd_ng.img" \
    -v "${SHARE}:/mnt/hostshare" \
    -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" \
    sickcodes/docker-osx:auto

If you aren't using :auto

You can mount the folder by using the command mount_9p hostshare when you are in side the guest

sickcodes avatar Apr 15 '21 22:04 sickcodes

@sickcodes Is there anyway or any lead on how to enable a shared clipboard between host and guest as well?

omarahm3 avatar Aug 27 '21 06:08 omarahm3

@sickcodes Is there anyway or any lead on how to enable a shared clipboard between host and guest as well?

Clipboard wont work because the guest doesn't have access to your clipbaord but if you use the VNC method you can get better latency for typing or autotyping with xdotool

sickcodes avatar Aug 27 '21 22:08 sickcodes

Fixed folder host sharing in https://github.com/sickcodes/Docker-OSX/commit/31c95fd640f70c657235f7440eca173500c6c9ae

sickcodes avatar Aug 27 '21 22:08 sickcodes

Good evening, @sickcodes!

I will become if I want to share the folders, and to increase more CPU and more RAM...

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

To

SHARE=/home/bene/

docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -v "${PWD}/mac_hdd_ng.img:/home/arch/OSX-KVM/mac_hdd_ng.img" \
    -v "${SHARE}:/mnt/hostshare" \
    -e OSX_COMMANDS="echo alpine | sudo -S mount_9p hostshare && /bin/bash" \
    -e RAM=16g \
    -e EXTRA="-smp 16,sockets=8,cores=2,-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=hostshare" \
    -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

Is it correct?

gusbemacbe avatar Apr 11 '24 22:04 gusbemacbe

@sickcodes, it almost worked, but I am unable to share or to use scp.

gusbemacbe avatar Apr 13 '24 03:04 gusbemacbe