Give Containers always the same usb devices

Hello,

I use an Ubuntu computer with multiple USB controller added per PCI-e cards. On each card an webcam and a serial interface (ch340) is plugged in. Every Container get one webcam and one serial converter. I use

devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
      - /dev/video0:/dev/video0

and USB1 and USB2 respectively video 2 and video 4 … for each container and all works fine. My problem is, every time i boot this computer, the order of numbers of USB devices an video is changed, numbers is given random.

“lsusb -t” prints out that:

....
Bus 07.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 3: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
        |__ Port 3: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
        |__ Port 4: Dev 4, If 0, Class=Vendor Specific Class, Driver=ch341, 12M
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
        |__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
        |__ Port 3: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 3: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 4: Dev 4, If 0, Class=Vendor Specific Class, Driver=ch341, 12M
.....

Is it possible to give --device e.g. the Bus Number ? Or anything else each container get every time the same usb devices

Thanks for help or hints!

No, but you can try to use other aliases or use udev to assign a specific name to devices:

For example: