Docker container can't see a serial port device

喜夏-厌秋 提交于 2019-11-30 07:37:09

As pointed by @pgayvallet on GitHub:

As the daemon runs inside a VM in Docker Desktop, it is not possible to actually share a mac host device with the container inside the VM, and this will most definitely never be possible.

You can check if the script described in "Notification of new USB devices in docker container" (from Guido Diepen -- gdiepen) can help.

He too runs his container with the --privileged argument to allow it to access the devices. And he mounts the host directory /dev/bus/usb to the /dev/bus/usb directory within the container with the argument -v /dev/bus/usb:/dev/bus/usb when starting said container.

The script uses both inotifywait and lsusb to wait for devices to be (un)plugged and check if it was the device we are interested in.

The inotifywait will keep on listening to inodes create/delete events under the dev/bus/usb directory and will execute commands whenever an inode corresponding to a relevant device has been just created.

See also, once you have detected an plugged USB device, How to get Bus and Device relationship for a /dev/ttyUSB (not related to Docker, but still relevant).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!