Provide access to USB device in a docker?


Spies

Recommended Posts

  • 2 years later...

the best method to passthrough usb to docker is via device by-id

open unraid terminal
type 

ls -l /dev/serial/by-id

 

you will get output of your devices with names

image.thumb.png.d371827b57ff04dc9d08d30380e94fef.png

 

copy the whole BLUE name of your device

 

go to your docker and edit config

 

add /dev/serial/by-id/  before pasting the name from above.

eg

/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_dcf756dbb712ec118bca20c7bd930c07-if00-port0

then add :/dev/zigbee to the end -  this is the container mount point

 

so you end up with this in your Docker Host config:

Quote

/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_dcf756dbb712ec118bca20c7bd930c07-if00-port0:/dev/zigbee

 

if anywere inside your docker program it asks for the device location you would set it to :
/dev/zigbee

 

image.png.3ba1e945bf3e41cc9e99c6e526faaecb.png

Edited by TRusselo
  • Like 1
Link to comment
  • 1 year later...
On 2/2/2023 at 6:57 PM, TRusselo said:

the best method to passthrough usb to docker is via device by-id

open unraid terminal
type 

ls -l /dev/serial/by-id

 

you will get output of your devices with names

image.thumb.png.d371827b57ff04dc9d08d30380e94fef.png

 

copy the whole BLUE name of your device

 

go to your docker and edit config

 

add /dev/serial/by-id/  before pasting the name from above.

eg

/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_dcf756dbb712ec118bca20c7bd930c07-if00-port0

then add :/dev/zigbee to the end -  this is the container mount point

 

so you end up with this in your Docker Host config:

 

if anywere inside your docker program it asks for the device location you would set it to :
/dev/zigbee

 

image.png.3ba1e945bf3e41cc9e99c6e526faaecb.png

Hi :)

 

Can you help me a little?

I tryed to get youre "Guide" to work but HA didnt see it

But after i did this it worked. But will it change after every reboot?

 

 

image.png

Link to comment
On 2/2/2024 at 1:48 PM, DanielPT said:

Hi :)

 

Can you help me a little?

I tryed to get youre "Guide" to work but HA didnt see it

But after i did this it worked. But will it change after every reboot?

 

 

image.png

yes it can change if you have more than 1 USB device.
if you only have one it will always be 0
by-id is the only sure way.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.