通过ADB连接到Docker容器中的USB Android设备 [英] Connecting to a USB Android device in a Docker container via ADB
问题描述
我创建了一个包含Android SDK的Docker映像,并试图在运行该映像的容器中公开我的Android手机。因此,我使用了-privileged
标志并按如下所示安装USB设备:
I have created a Docker image which contains the Android SDK and am trying to expose my Android phone in a container running this image. So I used the --privileged
flag and mounted the USB devices as follows:
$ docker run --privileged -v /dev/bus/usb:/dev/bus/usb -d -P my-android:0.0.1
但是,当我运行ADB设备时,它不会显示USB设备:
However, when I run ADB devices, it does not show me the USB device:
ubuntu@d56b666be455:~/Android/Sdk/platform-tools$ ./adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
ubuntu@d56b666be455:~/Android/Sdk/platform-tools$
容器内的lsusb列出设备:
lsusb inside the container lists the device:
ubuntu@d56b666be455:~$ lsusb
...
Bus 002 Device 017: ID 04e8:6866 Samsung Electronics Co., Ltd GT-I9300 Phone [Galaxy S III] (debugging mode)
设备在主机上可见:
⇒ ./adb devices
List of devices attached
4d11abcd65b74045 device
主机操作系统
$ uname -a
Linux ananya 3.16.0-33-generic #44~14.04.1-Ubuntu SMP Fri Mar 13 10:33:29 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Docker版本
$ docker --version
Docker version 1.5.0, build a8a31ef
可能是什么问题?
推荐答案
我认为设备上运行的ADB守护程序不能连接到两个ADB服务器。尝试从主机的ADB断开连接,然后将其连接到Docker容器的ADB。
I don't think the ADB daemon running on the device can be connected to two ADB servers. Try disconnecting it from your host machine's ADB and then connect it to the Docker container's ADB.
这篇关于通过ADB连接到Docker容器中的USB Android设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!