I'm using Docker Desktop on my Ubuntu 24 machine and need to access USB devices connected to my host, specifically through ttyUSB. I tried using the command 'docker run -it --device=/dev/ttyUSB0 --name dev_env ubuntu:22.04', but I encountered an error saying 'docker: Error response from daemon: error gathering device information while adding custom device "/dev/ttyUSB0": no such file or directory', even though the ttyUSB0 device is available in the /dev directory. Any advice on how to resolve this?
1 Answer
First, check what 'ls -al /dev/ttyUSB0' shows on your host. Sometimes, you might need specific group permissions. For instance, you might need to be part of the 'dialout' group or run it as root/sudo. So, make sure your current user has the right access.
It shows crw-rw-rw-+ 1 root dialout. And yes, by default Docker doesn’t require root/sudo.