how to see adb devices on linux container when host is windows 7 machine

断了今生、忘了曾经 提交于 2021-02-17 05:05:17

问题


i have a windows 7 machine with docker tool box installed

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

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

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

9ba51613a7be

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

i killed the adb daemon in local host machine with

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

List of devices attached

Kindly suggest what i am missing


回答1:


Just to add conclusion of this question.

Till date,I was not able to find a feasible solution to run windows docker on windows 7 machine. Most of the posts have been around windows docker with windows 10 and windows 2016 Server.

I switched to Linux docker on windows 7 machine, However the adb devices were still not recognized on Linux container

Lastly , i had to go for Linux host and Linux Container and the devices were visible on container.




回答2:


-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. Install ssh server on your host which is win 7 then from your container forwarding the port 5037. Run like:

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

  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.

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

So you just need to run:

docker run -p8081:8081 android_container

then

docker exec -it 9ba51613a7be adb devices

if you forwarded ports.

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



来源:https://stackoverflow.com/questions/48865721/how-to-see-adb-devices-on-linux-container-when-host-is-windows-7-machine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!