Docker Community Forums

Share and learn in the Docker community.

Exposing USB to Docker on Mac

Hello all.

I have a created Docker image running a Java app that needs access to a USB device. I have this running perfectly fine on Docker/Linux. I have now been tasked to get this working on a Docker/Mac, and eventually on Docker/Windows.

As a first point, I would like to confirm that I need “Docker Toolbox”, and not “Docker for Mac”, from the install page to get access to the USB?

On Docker/Linux I just use docker run --device /dev/ttyUSB0 .... This same command fails on Docker/Mac, of course.

According to various Net resources, I enabled USB in VirtualBox, and used the command docker run --privileged --volume /dev/bus/usb:/dev/bus/usb:rw ... With this command the docker container starts up, but my app fails to locate the USB device.

Am I missing something else?

I did some more investigation. After starting my Docker container, there is a file /dev/bus/usb/001/001. This does not appear correct.

Anyone have any ideas?

I did not have the USB correctly enabled in VirtualBox.
As for the question of needing Docker Toolbox or not, the answer is here: https://github.com/docker/for-mac/issues/900