Connecting to a USB Android device in a Docker container via 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.
While I was trying the same, I ran into some other problems related to that, which I would like to share so that others may save their time:
Problem 1: lsusb was not installed in the container
In my case lsusb was not installed, so I installed it with the below command:
apt-get update
apt-get install usbutils
Problem 2: not able to see the device even after lsusb and ADB SDK installation
You need to restart your container with the -v
option, and yes don't forget to kill the ADB server as stated in one of the answers.
On the host:
adb-kill server
docker run -ti -d --privileged -v /dev/bus/usb:/dev/bus/usb container_name
In case someone wanted do it from scratch, I have written a blog post on it:
How to connect ADB devices to Linux container