How do I access a USB drive on a OSX host from inside a docker container? How do I access a USB drive on a OSX host from inside a docker container? docker docker

How do I access a USB drive on a OSX host from inside a docker container?


I was finally able to access my USB drive from /var/media inside my container by using the machine-diskutil.sh script mentioned in warmoverflow's comment like so

machine-diskutil.sh mount my-machine-name /Volumes/my-usb-drive

and then starting the container like so

docker run -v /Volumes/my-usb-drive:/var/media -it my/image:latest bash

Because I had tried to add /Volumes/my-usb-drive as a shared folder manually in VirtualBox, I first got this error.

Error: The shared folder /Volumes/Seagate already exists on the docker machine, please unmount it first.

So I removed it manually and re-ran the machine-diskutil.sh mount command without any problems. Great stuff!


As per @pgayvallet comment on GitHub:

As the daemon runs inside a VM in Docker Desktop, it is not possible to actually share a mac host device with the container inside the VM, and this will most definitely never be possible.