当主机是Windows 7机器时如何在linux容器上查看adb设备 [英] how to see adb devices on linux container when host is windows 7 machine

查看:87
本文介绍了当主机是Windows 7机器时如何在linux容器上查看adb设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台安装了docker工具箱的 windows 7 机器

i have a windows 7 machine with docker tool box installed

我从下面的链接下载了安装了adb的图像和运行容器

i downloaded image and running container which have adb installed in it from below link

https://hub.docker.com/r/muicoder/adb/

容器已启动并正在运行,容器ID如下所述

The container is up and running, with container id mentioned below

9ba51613a7be

在我的主机(Windows 7)上,我已连接 nexus 6 ,并且可以通过

on my host machine(windows 7) , i have nexus 6 connected and i can see the result with

adb devices


> C:\Users\panmishr>adb devices List of devices attached
> * daemon not running; starting now at tcp:5037
> * daemon started successfully 
> * ZY2235CQ26      device

我使用

adb kill-server

现在我正在尝试使用以下命令检查容器上的设备,但是它没有显示任何映射到容器的设备.

Now i am trying to check the devices on container with below command, however it is not showing any devices mapped to container.

$ docker exec -it -d --privileged -P -p 5037:5037 9ba51613a7be adb devices

连接的设备列表

请提示我所缺少的内容

推荐答案

-p 5037:5037 用于查看在上键入 adb devices 时容器上正在运行的设备主人.但是,在容器中键入 adb devices 时,您会看到主机上已连接的设备.为此

-p 5037:5037 is for seeing devices whis is running on container when typing adb devices on the host. But you would see devices connected on the host when you type adb devices in the container. For this

  1. 在主机上安装ssh服务器,该服务器是win 7,然后从容器中转发端口5037.运行方式:

$ ssh -T -N -L5037:127.0.0.1:5037 root@host.ip host.ip可能是: 192.168.0.10

$ ssh -T -N -L5037:127.0.0.1:5037 root@host.ip host.ip may be: 192.168.0.10

  1. 在容器上安装ssh服务器,但首先在主机上暴露映射5022的容器端口22.(在配置/etc/ssh/sshd_config 文件之后).像这样运行:主机中的 $ ssh -T -N -R5037:127.0.0.1:5037 root@127.0.0.1 -p 5022 .
  1. install ssh server on your container but first expose the container port 22 mapping 5022 on your host. (After configuring your /etc/ssh/sshd_config file). Run like: $ ssh -T -N -R5037:127.0.0.1:5037 root@127.0.0.1 -p 5022 in your host for remote forwarding.

在选择两个选项之前,应将主机上的端口8081映射为: -p8081:8081

Before one option of two, you shoul map the port 8081 on your host like: -p8081:8081

所以您只需要运行:

docker run -p8081:8081 android_container

然后

docker exec -it 9ba51613a7be adb devices

如果您转发了端口.

您还为此提供了另一种解决方案.请检查此存储库: RN-Container-with-ADB-Real-Device

You have also another solution for this. Please check this repo: RN-Container-with-ADB-Real-Device

这篇关于当主机是Windows 7机器时如何在linux容器上查看adb设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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