mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

Webcam not available for Ring #86

Closed DBLouis closed 5 years ago

DBLouis commented 5 years ago

I am trying to use Ring in docker. I used your XFCE image as a base. The --webcam option seems to work, I see /dev/video0, but Ring does not detect a camera. I tried on the host of course and it work (with Cheese). I noticed that the /dev/video0 not own by the video group in the container, contrarily to the host.

Here is the Dockerfile: https://framagit.org/snippets/2693

mviereck commented 5 years ago

Thanks for reporting!

I've build your Dockerfile and can confirm that gnome-ring does not work ootb.

I got it to work with two changes:

x11docker --webcam --systemd --gpu --desktop -- --privileged -- gnome-ring-image

Running with --privileged is a breakdown of container isolation, I cannot recommend it. Maybe it can be tracked down to a less privileged setup. Though, I once failed to run cheese with less privileges than --privileged. I doubt it will be better with gnome-ring, but I don't know. (Other webcam applications like guvcview don't need --privileged.)

I noticed that the /dev/video0 not own by the video group in the container, contrarily to the host.

That does work here, /dev/video0 belongs to group video in container. Can you please show me ls -l /dev/video0 in container and, for comparision, on host?

mviereck commented 5 years ago

Good news! I found that gnome-ring and cheese need some device information from udev. Option --webcam now shares read access to /run/udev/data.

Now it is enough for cheese and gnome-ring to run with --webcam and --systemd or --dbus-system. No special privileges except webcam access are needed anymore.

Please update to latest master version or run with --sharedir /run/udev/data if you want to stay with current stable release.