How to use USB3 VISION device in docker with udev symlink?

i’m trying to access a USB3 VISION camera from within a docker container (based on Ubuntu) using Aravis.

this works if i’m mounting /dev/bus/usb into the container:

docker run -it -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule 'a 189:* rmw' my-camera-module-camera bash

however, i had wanted to only mount the specific USB device. since the name inside /dev/bus/usb is not stable (depends on where you plug it in and e.g. with usbipd when running in WSL2 it always gives a new ID for each attach/detach cycle) i decided to add a udev rule to have a symlink:

ACTION!="remove", ATTR{idVendor}=="2ba2", ATTR{serial}=="...", SYMLINK+="my_camera"

this works fine and the device shows up on the host:

lrwxrwxrwx 1 root root 15 Dec  2 08:51 /dev/my_camera -> bus/usb/002/002

however, if i now launch the docker container with this device mounted then it can’t find the camera:

docker run -it -v /dev/my_camera:/dev/my_camera --device-cgroup-rule 'a 189:* rmw' my-camera-module-camera bash

lsusb -v (in the running container) shows some subtle differences between the two docker launches, namely the Binary Object Store Descriptor is present on the camera devices if i mount /dev/bus/usb but not when i mount the symlink.

does anyone know what i’d need to do in order to only mount the camera?
it’s not strictly necessary, but i’d prefer to name the devices explicitly for the docker container to avoid potential interference if i add other devices in the future (for use in other docker containers).

thanks!

Hi,

Did you find a solution to your issue ?

Emmanuel.

no, sadly not. i just mounted /dev/bus/usb and called it a day. if anyone has a solution i’d still be interested!