I am trying to use Docker for one of our projects that uses OpenCV to handle webcam feeds (Python). But I can’t access the webcam in the docker, here is the code that I use to check access to the webcams:
python -c "import cv2;print(cv2.VideoCapture(0).isOpened())"
And here is what I have tried so far,
docker run --device=/dev/video0 -it rec bash
docker run --privileged --device=/dev/video0 -it rec bash
sudo docker run --privileged --device=/dev/video0:/dev/video0 -it rec bash
They all return False, what am I doing wrong?
source
share