On this page
Passing USB into Docker
To let Docker use USB we pass them in using the --device
flag
Here is an example with our USB to UART adapter and Lidar plugged in
sudo docker run --rm \
--device /dev/ttyUSB0 \
--device /dev/ttyUSB1 \
my-image bash
On linux devices show up in the /dev
folder as files.
So in our case the USB devices show up as /dev/ttyUSB0
To find which files in /dev
are the correct USB ports I just plug run the command below then unplug and run the command again.
ls /dev/tty*
the difference is the file that represents the USB port