尝试从Windows中的Docker访问USB设备 [英] Attempting to access a USB device from Docker in Windows
问题描述
确切地说,我无法找到有关如何从Docker在Windows中访问USB设备的任何说明,尽管这些说明在这里,尽管来自Mac OS X,却非常接近。
I've not been able to locate any instructions on how to access a USB device from Docker in Windows, exactly, although the instructions here, despite being from Mac OS X, come pretty close.
所以我m在Windows上尝试此操作,到目前为止,这是我所做的:
So I'm trying this on Windows, and here's what I've done so far:
- 将Oracle VirtualBox升级到5.0.16,并安装了<一个href = http://download.virtualbox.org/virtualbox/5.0.16/Oracle_VM_VirtualBox_Extension_Pack-5.0.16-105871.vbox-extpack rel = noreferrer> Oracle VM VirtualBox扩展包,它允许boot2docker VM能够使用USB 2.0访问我的设备。
- 关闭
默认
虚拟机的电源,然后转到Machine→设置…→USB。通过从弹出列表中选择机器,添加了新的USB过滤器。 - 重新启动Docker快速入门终端。
- Upgraded Oracle VirtualBox to 5.0.16, and installed the Oracle VM VirtualBox Extensions Pack, which allows the boot2docker VM the ability to use USB 2.0 to access my device.
- Powered off the
default
virtual machine, and went to Machine → Settings… → USB. Added new USB filter, by selecting the machine from the pop-up list. - Restarted the Docker Quickstart Terminal.
问题是,我怀疑用于运行虚拟机实例的命令如下:
The thing is, I suspect that the command for running the virtual machine instance is something as follows:
docker run --privileged -v <USB directory in host machine>:<USB directory in Docker container> ...
问题是,在Mac OS X中似乎是 / dev / bus / usb
,它在Windows中出现在哪里?是不是在同一地方? / dev /
目录似乎没有 / dev / usb /
。
The problem is, while in Mac OS X it appears to be /dev/bus/usb
, where does it appear in Windows? Isn't it the same place? The /dev/
directory doesn't appear to have /dev/usb/
.
我错过了一步吗? USB设备路径是否在Windows的其他位置?
Have I missed a step? Is the USB device path in a different place for Windows?
顺便说一句,这是我键入 docker -v
:
By the way, this is the version of Docker that I'm using when I type docker -v
:
Docker version 1.10.0, build 590d5108
我目前也在使用Windows 7。
I'm also currently using Windows 7.
推荐答案
尽管没看到/ dev / bus / usb并键入以下命令,但看起来还是硬着头皮:
Looks like biting the bullet, despite not seeing /dev/bus/usb and typing the following command works:
docker run -it --privileged -v /dev/bus/usb:/dev/bus/usb ...
(在我的例子中是 docker run-it --privileged -v / dev / bus / usb:/ dev / bus / usb -v(共享目录路径): (容器中的路径)debian:latest bash
,但是您的命令会根据您的操作而有所不同)。
(in my case, it was docker run-it --privileged -v /dev/bus/usb:/dev/bus/usb -v (shared directory path):(path in container) debian:latest bash
, but your command will be different depending on what you're doing).
如果如果您正在使用Android设备,并且想要在引导加载程序上访问它们时仍要访问它们,则需要在VirtualBox中创建两个过滤器:一个用于您使用时ng ADB,当您使用fastboot时,另一个。
Also, if you're working on Android devices and you want to still access them when they're on the bootloader, you will need to create two filters within VirtualBox: one for when you're using ADB, the other when you're using fastboot.
这篇关于尝试从Windows中的Docker访问USB设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!