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

被刻印的时光 ゝ 提交于 2019-12-22 05:41:29

问题


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!


回答1:


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


来源:https://stackoverflow.com/questions/28641128/where-to-install-device-drivers-to-make-docker-recognize-the-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!