4

I was able to host my USB device with the help of this Stack Overflow post

docker run -t -i --privileged -v /dev/bus/usb:/dev/bus/usb ubuntu bash

This hosts all the connected USB devices.

Is there a way in which I can host one particular device?

Let's say the USB file resides in /dev/bus/usb/002/005. I would like this file alone to be hosted on my container.

I tried docker run -t -i --privileged -v /dev/bus/usb/002/005:/dev/bus/usb/002/005 ubuntu bash, but it still hosts the entire usb directory.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Febin K G
  • 93
  • 1
  • 8

1 Answers1

4

Try --device /dev/bus/usb/002/005.

Side note: Docker version 1.17 from the Ubuntu repository has a bug with option --device that does not set group ownership of a shared device in a container to the same as on the host. If you have issues for this reason, try:

--device /dev/bus/usb/002/005 --volume=/dev/bus/usb/002/005:/dev/bus/usb/002/005

Never use --privileged for anything except short debugging tests.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mviereck
  • 1,309
  • 1
  • 12
  • 15