是否可以将usb设备暴露给lxc / docker容器? [英] Is it possible to expose a usb device to a lxc/docker container?

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

问题描述

我有一个Docker文件中包含的嵌入式系统开发映像。为了闪存代码,我需要通过USB Serial连接到节点(例如/ dev / ttyACM0)。



对于docker,我使用新的bind mount功能(请参阅 https://github.com/dotcloud/docker/issues/111 ,-b或latedly?-v选项)将主机devfs公开到容器。然而,每当我连接(cat / d / ttyACM0,d是到dev的绑定装载)到设备,我得到操作不允许。是否可能不仅绑定mount但实际使用容器中的字符设备?



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

解决方案

- 设备选项现在允许将开发人员容器,例如:

  docker运行-t -i --device = / dev / ttyUSB0 ubuntu bash 

(发现自这个SO答案。)


I have a 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).

With docker I used the new bind mount feature to (see https://github.com/dotcloud/docker/issues/111, -b or latedly? -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?

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

解决方案

The --device option now allows exposing a dev to a container, eg.:

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

(Found from this SO answer.)

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

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