How to share an non-storage USB device between host and container on OSX

This is more a OSX related issue but someone might have some experience on this with Docker, so I post it here.

I recently created a Docker image available on the Docker HUB : oroger/pypassport.

This image rely on the presence of an USB smartcard reader shared between the host and the container. This work fine on Ubuntu using either --device or --priviledged and a volume on /dev/bus/usb.

However, I did not find a way to share such a device on OSX. I did some digging and it appears that non-storage USB devices are not mounted under /dev.

I was wondering if there was another way to use the same image on OSX. If not I would also be interested in any way to would require to create a new Docker image some other way.

Expected behavior

Having access to a USB smatcard reader plugged in the Docker host.

Actual behavior

No access to non-storage host device

1 Like

I am facing the same problem, wanted to connect my camera to my docker image.

sudo docker run –device /dev/video0:/dev/video0 -p 9000:9000 -p 8000:8000 -a stdin -it project_image /bin/bash (this will interface camera (device) with my docker image in ubunutu distribution)

Needed the information about the simillar implementaion in MacOS, guess need to change the bold part according to mac.

The device driver or incase of ubuntu there a library which we need to install which will provide the location where the data is being stored ex v4l2–ctl --list-devices, is there anything similar in MAC OS ??

As I understand, “xhyve” (the native MacOS VM) don’t have USB support at all.
So any attempt to make this work will fail :-/
For my part, I go back to Docker ToolBox until I find some better solution.
XHYVE: “Notably absent sound, USB, HID and any kind of graphics support.”

Appelgren 幸