I have been using Docker for running Android tests. I am using multiple containers and Android devices to run tests in parallel, but I am facing an issue while redirecting the USB devices to a Docker container.
I am mounting the device like:
docker run -it --name MVE1 --privileged -v /dev/bus/usb/001/023:/dev/bus/usb/001/023
I am trying to mount only one device, but when I run adb
devices inside the container, it lists all the devices which are connected to the host.
No luck even with the --device option
either:
docker run -it --name MVE1 --device=/dev/bus/usb/001/023:/dev/bus/usb/001/023
Location of the USB devices on my host /dev/bus/usb/
: There are two bus 001
and 002
devices that I am using and they are all connected to the 001 bus
.
Why is Docker mounting the all devices connected to host on 001 bus
when I tried to connect only one device?
Am I doing anything wrong?
I was able to figure this out. If we run in privileged mode, all USB busses are available to the container.
We just need to delete the unwanted bus from the container. Though the volume is in sync, this deletion will not effect the USB bus in Docker host.