On a Linux host machine, you just launch the Docker Container with the privileged argument and the /dev/bus/usb volume.
The command looks like this : docker run -ti --privileged -v /dev/bus/usb:/dev/bus/usb -d 7ff25ab37633
On Mac OS, you can’t use the volume as it is not handle that way on Mac OS.
Following these steps, you should be able to connect to your Android Device, through adb within a Docker Container on a Mac host machine.
You can connect wirelessly to your device through adb.
So you just have to connect wirelessly and then connect to your device from your container. It works on Linux, Mac and Windows, so it is pretty consistent if you want to develop on a bunch of different OS.
The way to achieve it is :
Connect your Android device to your host machine with a USB cable.
On your host machine run :
adb devices
You should see your device as connected
On your host machine run, to connect wirelessly to your device :
adb tcpip 5555
adb connect 192.168.0.5:5555 (replace the ip address with your android devices)
adb devices
You should see your device connected through USB and wirelessly
Disconnect the USB cable, run adb devices and check that the wireless connection is still active
Launch your Docker container
On your Docker Container, run the following commands :
adb connect 192.168.0.5:5555
adb devices
If you see and unauthorized device, try these commands to fix the issue :