Created
October 17, 2021 20:29
-
-
Save ofstudio/ab8001a21c257d67255c9f43451132c0 to your computer and use it in GitHub Desktop.
How to mount USB device to docker container in rootless mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to mount RTL-SDR (Flightaware) USB dongle | |
# to docker container in rootless mode | |
# | |
# For example running: `docker run --device=/dev/bus/usb:/dev/bus/usb ...` | |
# | |
# or via docker compose: | |
# | |
# version: '3' | |
# services: | |
# dump1090: | |
# build: ./dump1090 | |
# container_name: air_dump1090 | |
# devices: | |
# - /dev/bus/usb:/dev/bus/usb | |
# ... | |
# | |
# STEP 1. List USB devices | |
lsusb -v | |
# STEP 2. Find your RTL SDR Device Descriptor | |
# For example: | |
# | |
# Device Descriptor: | |
# bLength 18 | |
# bDescriptorType 1 | |
# bcdUSB 2.00 | |
# bDeviceClass 0 | |
# bDeviceSubClass 0 | |
# bDeviceProtocol 0 | |
# bMaxPacketSize0 64 | |
# THIS => idVendor 0x0bda Realtek Semiconductor Corp. | |
# THIS => idProduct 0x2832 RTL2832U DVB-T | |
# bcdDevice 1.00 | |
# iManufacturer 1 Realtek | |
# iProduct 2 RTL2832U | |
# ... | |
# | |
# STEP 3. Replace idVendor and idProduct values in the command below (without "0x"): | |
# "0bda" and "2832" in my case | |
# | |
# STEP 4. Create udev rule in /etc/udev/rules.d/90-usb-rtlsdr.rules | |
sudo echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTR{idProduct}=="2832", MODE="0666"' > /etc/udev/rules.d/90-usb-rtlsdr.rules | |
# STEP 5. Reload rules via udev management tool | |
sudo udevadm control --reload-rules && sudo udevadm trigger | |
# STEP 6. Restart the container that uses the device | |
docker restart <my-dump1090-container> | |
# Have fun! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment