Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to install device drivers to make docker recognize the device?

I have some binaries running on ubuntu that control various devices like onboard/usb wifi/bluetooth chips. Some chips will require additional drivers.

My guess is that merely installing the drivers to the docker image is not enough, and the host OS must have the drivers. Is this correct?

If yes, why does the docker image need any drivers at all if the host already does? How can docker image correctly delegates to host? Do these need to be hardcoded for each driver on each host OS?

Also from this perspective, does docker require more or less hardcoding than a VM?

I feel the answer probably depends on how the devices are presented to docker and where the driver has to run (e.g kernel space vs user space).

Thanks!

like image 493
Yey Avatar asked Feb 21 '15 01:02

Yey


1 Answers

It will depend the device and drivers. Most drivers need some support from Kernel, and in those cases your host kernel must provide the functionality. Some of the driver's functionality, dependent libraries and applications may be implemented in userspace (for example packages libusb, usbutils...) and your container should have those packages installed. And also, when running your container, you must explicitly indicate Docker to map the device in your container (any /dev/*). You have two options:

  1. Use docker run with option --device
  2. Use docker run mapping the device as a volume (option -v) in privileged mode --privileged=true
like image 116
Javier Cortejoso Avatar answered Oct 19 '22 10:10

Javier Cortejoso