Is it possible to access a USB camera (e.g Logitech c270) from a Docker container? The camera is connected to a Mac host via a USB port. Even when running the container with --privileged, i could not find the device (e.g /dev/video0 file does not exist).
Thanks
The default docker-machine creates a virtual machine with official boot2docker.iso
. And this slim distro doesn't support USB video device. When you attach the USB device to the virtual machine, the kernel can't do anything without the right driver. So, you won't see any video capturing device, such as /dev/video0
.
TL;DR
I've compiled a customized boot2docker.iso which ships uvcvideo
driver. Use this one to create you docker machine.
docker-machine create -d virtualbox --virtualbox-boot2docker-url https://github.com/Alexoner/boot2docker/releases/download/v17.06.0-ce-usb-rc5/boot2docker.iso default
Then install the VirtualBox extension, attach the webcam device, you are good to go!
Reference
Attach webcam: https://www.virtualbox.org/manual/ch09.html#webcam-passthrough
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With