Linux Containers

The LXD version must be 2.5 or upper.

All commands are at the host side

With lsusb find the usb dev you want to attach to the container, for example I will be attaching a Logitech webcam

lsusb Bus 001 Device 002: ID 046d:0826 Logitech, Inc. HD Webcam C525

At the ID field, the first number is the vendor ID and the 2nd number is the product ID, in my case 046d:0826

Now all to be done is to give this command

lxc config device add cam logitech usb vendorid=046d productid=0826

cam is the lxc name I am attaching the usb dev

logitech is like to call this device in the container

vendor and product id was described before

Especially for webcams this must be applied at the host lxc config device add my-container video0 unix-char path=/dev/video0