在哪里安装设备驱动程序以使docker识别设备? [英] Where to install device drivers to make docker recognize the device?

查看:123
本文介绍了在哪里安装设备驱动程序以使docker识别设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ubuntu上运行了一些二进制文件,可以控制各种设备,例如板载/ usb wifi /蓝牙芯片。某些芯片将需要其他驱动程序。

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

我的猜测是仅将驱动程序安装到Docker映像是不够的,并且主机OS必须具有驱动程序。这是正确的吗?

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?

如果是,为什么在主机已经存在的情况下,docker镜像根本不需要任何驱动程序?泊坞窗图像如何正确委派给主机?是否需要对每个主机OS上的每个驱动程序进行硬编码?

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?

从这个角度来看,docker是否比VM需要更多或更少的硬编码?

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

我认为答案可能取决于如何将设备呈现给docker以及驱动程序必须在哪里运行(例如内核空间与用户空间)。

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).

谢谢!

推荐答案

这将取决于设备和驱动程序。大多数驱动程序需要内核提供一些支持,在这种情况下,您的主机内核必须提供该功能。某些驱动程序的功能,相关的库和应用程序可以在用户空间中实现(例如,软件包libusb,usbutils ...),并且您的容器应已安装了那些软件包。而且,在运行容器时,您必须明确指示Docker将设备映射到容器中(任何/ dev / *)。您有两个选择:

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. 使用 docker run 和选项-设备

  2. 使用 docker run 将设备映射为卷(选项 -v )在特权模式下-privileged = true

  1. Use docker run with option --device
  2. Use docker run mapping the device as a volume (option -v) in privileged mode --privileged=true

这篇关于在哪里安装设备驱动程序以使docker识别设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆