android – Run adb on multiple docker containers

Question:

I have four phones connected via USB. I have two containers docker running on my machine and each of them has an adb running. The adbs selects cell phones randomly, I would like to map two cell phones to one docker and two cell phones to the other.

All devices are listed in /dev/ttyACM3/

Is there a way to map the device to a specific docker? Or the opposite, make the docker recognize only certain devices?

What I tried so far was to mount the device individually, if I mount /dev/ttyACM3/001 for example, in a container, adb recognizes it, but when it is reconnected the file can change from 001 to 002, or 003, or 004 , depends on how the operating system assembles the devices, or in what order.

Answer:

You can create a udev rule with the name based on código serial of the usb port, and pass that code to the docker.

Scroll to Top