I'm not sure that this is even possible, but is there a way to access my camera inside docker container? I'm not using external camera but built-in in my mac.
I'm not sure that the flag volume (-v
) is the best practice to do so.
According to the github of jfrazelle, docker engineer who wrote many Dockerfile and docker run
for many graphical app such as chromium, skype, spotify, and so on, the flag and argument you should use is --device /dev/video0
.
For quick test(tested on ubuntu), below code should give supported frame resolution of cameras:-
docker run --rm -it --entrypoint /bin/bash --device /dev/video0 jrottenberg/ffmpeg
ffmpeg -f video4linux2 -list_formats all -i /dev/video0
You can try to forward your webcam device using -v flag
Something like
sudo docker run -d -p 55555:22 --privileged -v /dev/video0:/dev/video0 testimage
To list all devices attached to USB use lsusb
; to list all devices attached to PCI use lspci
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