SumiForum
    • Categories
    • Recent
    • Tags
    • Popular
    • Games
      • MFME
      • Virtual Pinball
    • Register
    • Login

    Passthrough USB to Docker

    Scheduled Pinned Locked Moved Docker
    1 Posts 1 Posters 66 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • SumisuS Offline
      Sumisu Administrator
      last edited by

      In this example I will be passing through a Sonoff Zigbee antenna to a Ubuntu 22.04 server running Docker. We will be adding the device to a Home Assistant container within Docker.


      First you’ll need to plug the USB antenna into your computer (In my case I am running an Ubuntu 22.04 server). If you need to find what version you are running, you can use:

      lsb_release -a
      
      1. SSH into the server and run:
      ls /dev/serial/by-id
      

      This will list the USB devices plugged in, and you should see an output like this: usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_<Device ID>-port0. The <Device ID> will be whatever it shows when you run the command above. You will need to copy this line of text, because this is what we are going to be pasting into our Docker Compose file.


      In the compose file, we need to add the device like this:

          devices:
          - /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_<Device ID>-port0
      

      Here is an example with Home Assistant:

      services:
        homeassistant:
          container_name: homeassistant
          image: "ghcr.io/home-assistant/home-assistant:stable"
          ports:
            - "8123:8123"
          volumes:
            - homeassistant-config:/config
            - /etc/localtime:/etc/localtime:ro
            - /run/dbus:/run/dbus:ro
          restart: unless-stopped
          devices:
          - /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_<Device ID>-port0
      volumes:
        homeassistant-config:
      

      After you restart the container the device should show up in the Devices & services menu within the Home Assistant settings. I believe this will work for other USB devices and other containers, but I have only tried it with this specific example.

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Forum Stats

      0

      Online

      3

      Users

      30

      Topics

      30

      Posts

      Ad

      © 2024 Sumisu

      • Home
      • Categories
      • Popular