'How do I get webcam acess permissions in docker?
I'm trying to acess webcam from docker image. My permissions:
dockerx@85ca088a4e0c:~$ ls -la /dev/vid*
crwxrwxrwx+ 1 root 986 81, 0 May 29 08:52 /dev/video0
crwxrwxrwx+ 1 root 986 81, 1 May 29 08:52 /dev/video1
dockerx@85ca088a4e0c:~$ groups dockerx
dockerx : dockerx root video x2gouser
So, in theory, i have permissions to acess /dev/video*, but attempt to acess it (via vlc, for example) causes error:
dockerx@85ca088a4e0c:~$ vlc
VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7)
[00005629e3774420] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-dockerx'
[00005629e3778390] main playlist: playlist is empty
[00007f5ca80010e0] v4l2 demux error: cannot open device '/dev/video0': Operation not permitted
[00007f5ca80010e0] v4l2 demux error: cannot open device '/dev/video0': Operation not permitted
[00007f5ca8003350] v4l2 stream error: cannot open device '/dev/video0': Operation not permitted
[00007f5ca000c800] v4l2 demux error: cannot open device '/dev/video1': Operation not permitted
[00007f5ca000c800] v4l2 demux error: cannot open device '/dev/video1': Operation not permitted
[00007f5ca000d130] v4l2 stream error: cannot open device '/dev/video1': Operation not permitted
QObject::~QObject: Timers cannot be stopped from another thread
Why can this happen?
Upd.: My Dockerfile, entrypoint.sh
UPD2. If you vote against, please spend one minute to say why. Thank you.
Solution 1:[1]
In the container, I was a non-root user called "developer". I had to add this line to my dockerfile:
RUN sudo usermod -a -G video developer
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
