Search code examples
dockergstreamer

How do I run gst-device-monitory-1.0 from Docker


I have been looking for this for some time now but I can't get gst-device-monitor-1.0 to work from a Docker container.

$ gst-device-monitor-1.0 finds a bunch of devices and prints to stdout.
$ docker run --rm -it --privileged ggoussard/gstreamer gst-device-monitor-1.0 just prints

Probing devices...

No devices found!

I have tried with --dev=/dev/snd but that does not help.

What do I need to pass to my docker command to have gstreamer find my devices on host?


Solution

  • I found a solution to this!

    I used

    > strace gst-device-monitor-1.0 Video/Source 2>&1 | grep ^access
    access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
    access("/run/udev/control", F_OK)       = 0
    access("/sys/subsystem", F_OK)          = -1 ENOENT (No such file or directory)
    access("/sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.3/5-2.3:1.0/video4linux/video1/uevent", F_OK) = 0
    access("/sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.3/5-2.3:1.0/video4linux/video0/uevent", F_OK) = 0
    access("/sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.3/5-2.3:1.0/video4linux/video0/uevent", F_OK) = 0
    access("/sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.3/5-2.3:1.0/video4linux/video1/uevent", F_OK) = 0
    

    on my machine to find out what the tool needs access to. Then it was easy: just mounting /run/udev from the host by adding -v /run/udev:/run/udev to the docker run command did the trick! gst-device-monitor-1.0 now works inside my docker container as expected.