是否可以将USB设备暴露于LXC/Docker容器? [英] Is it possible to expose a USB device to an LXC/Docker container?

查看:132
本文介绍了是否可以将USB设备暴露于LXC/Docker容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Docker文件中包含一个嵌入式系统开发映像.为了刷新代码,我需要通过USB串口(例如/dev/ttyACM0)连接到节点.

I have an embedded system development image contained in a Docker file. In order to flash the code I need to connect to the nodes via USB Serial (e.g. /dev/ttyACM0).

在Docker上,我使用了新的绑定安装功能(请参见 https://github.com /dotcloud/docker/issues/111 -b或更新的-v选项),以将主机devfs暴露给容器.但是,每当我将设备连接到设备("cat/d/ttyACM0",d是对dev的绑定安装)时,都会得到不允许操作".不仅可以绑定安装,还可以在容器中实际使用字符设备吗?

With Docker I used the new bind mount feature to (see https://github.com/dotcloud/docker/issues/111, -b or more recently the -v option) to expose the hosts devfs to the container. However, whenever I connect ("cat /d/ttyACM0", d is the bind mount to dev) to the device I get "operation not permitted". Is it possible to not only bind mount, but actually use character devices in the container?

是否有可能通过udev规则公开特定的开发人员?

Would it be maybe even possible to expose specific devs via udev rules?

推荐答案

--device选项现在允许将/dev暴露于容器中,例如:

The --device option now allows exposing a /dev to a container, for example:

docker run -t -i --device=/dev/ttyUSB0 ubuntu bash

(我从此堆栈溢出答案中找到.)

这篇关于是否可以将USB设备暴露于LXC/Docker容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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