docker container give usb access code example
Example: docker container give usb access
There are a couple of options. You can use the --device
flag that use can use to access USB devices without --privileged mode:
docker run -t -i --device=/dev/ttyUSB0 ubuntu bash
Alternatively, assuming your USB device is available
with drivers working, etc. on the host in /dev/bus/usb,
you can mount this in the container using privileged mode
and the volumes option. For example:
docker run -t -i --privileged -v /dev/bus/usb:/dev/bus/usb ubuntu bash
Note that as the name implies, --privileged is insecure
and should be handled with care.