google / gousb

gousb provides low-level interface for accessing USB devices
Apache License 2.0
845 stars 124 forks source link

How to use in a Docker container without --privileged #119

Open half2me opened 1 year ago

half2me commented 1 year ago

Is there any example for this being used inside a docker container without privileged mode? I have an app which uses this to speak to a USB device, but as soon as I run my application in a container it no longer finds the device unless I use the --privileged flag. Is there a way I can maybe use the --device option? I'm using this under linux on a raspberry pi

frelon commented 10 months ago

Hi @half2me, I just stumbled upon this issue and I have been using the following docker run --device=/dev/bus/usb/<bus>/<device> to share the device without the --privileged flag.

Hope it helps!

dhkimxx commented 1 week ago

Or Try This: docker run -v /dev/bus:/dev/bus:ro -v /dev/serial:/dev/serial:ro ...