USB Device not working not sure why

I am running a container that needs a USB device to work. The application in the container requires a licencing dongle.

I have managed to make it work using --device=/dev/bus/usb/003/003.

My issue is that i can not guarantee that the USB wont be unplugged. if this is the case a new ID is assigned. so the 003/003 would become 003/004. every time the device is unplugged it will assign a new id. If the Server is rebooted then the ID will start back at the lowest number in my case 003. This means start up script would need to know what ID the usb is plugged into

I have tried using the dev name for the devices but it does’nt work. the key when plugged in generates

I have mounted both of these using --device= but it didnt work. I cant work out why.
I used privileges mode and that did work but I found it removed the device from the host which isn’t a problem. If the container was stopped then the device isn’t present on the host machines /dev folder any more and i cant start the container again as it cant find /hidraw1, it does still exsit in /dev/bus/usb/003/ directory tho. The solution was to unplug the usb and plug it back in. Again this isn’t really a solution.

I have looked at :rwm and that didn’t help me
i have tried mounting them using -v and --device as the same time.
I am running docker on Ubuntu 14.10 desktop version and will migrate it to server

Wonder if anyone out there can throw some light on the subject


sudo udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/001/003)

You can write a shell script with above command where you can fetch all the port and devices plugged in.

This will show device attribute and you can identify proper device using


from the script use proper device to map with docker.

1 Like


I am also trying to pass a POS printer to docker.
I am running my container with docker run -it --device=/dev/bus/usb/001/009:/dev/bus/usb/001/009 --security-opt seccomp:unconfined 8c92df74731f /bin/bash

I have this udev rule in the container:
/etc/udev/rules.d/99-usb.rules SUBSYSTEM=="usb", GROUP="usbusers", MODE="0660" SUBSYSTEMS=="usb", GROUP="usbusers", MODE="0660"

This rule permits users in group usbusers to read/write to usb devices.

The problem is that somehow this udev rule is no being executed.

The only way that I have to grant access to usb to the group usbusers is by executing the udevadm test…

udevadm test $(udevadm info -q path -n /dev/bus/usb/001/009) 2>&1

Can anyone help me understand why the udev rule is not running without executing the udevadm test?? I have tried the same rule on a VM, instead of a container and it works…

Best Regards,

This is a better way to do it that will work even if you unplug/replug your device after the container has started

Basically you have to use devices.allow in cgroup to allow all the character devices of that major number