问题
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
- 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
- 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