Access a USB webcam hosted on OS X from a Docker container

Can I access a USB camera (e.g. Logitech c270) from a Docker container? The camera connects to the Mac host via a USB port. Even when I started the container with --privileged, I could not find the device (for example, the file / dev / video 0 does not exist).

thanks

+5
source share
1 answer

The default docker engine creates a virtual machine with official boot2docker.iso . And this thin distribution does not support a USB video device. When you attach a USB device to a virtual machine, the kernel cannot do anything without the right driver. Thus, you will not see any video capture device, for example /dev/video0 .

TL DR

I have compiled a customized boot2docker.iso that sends the uvcvideo driver. Use this to create a docker.

 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 device to the webcam, and you're good to go!

Link

Attach a webcam: https://www.virtualbox.org/manual/ch09.html#webcam-passthrough

+2
source

Source: https://habr.com/ru/post/1260937/


All Articles