I'm trying to start a JAVA server (SPRING) container which runs ADB commands. I have created a docker-compose (I start many containers together..) file but I can't see the devices connected on the machine. I found solutions on how to do this as mention here but it doesn't uses docker compose.
Note: I use Docker for windows 10.
This is what I wrote down in the meantime:
version: '3.8'
services:
java-server:
image: openjdk:8
privileged: true <----- I thought this should help
pid: "host"
ports:
- target: 80
published: 80
protocol: tcp
mode: host
- target: 5037 <----- I thought this should help, expose the adb port
published: 5037
protocol: tcp
mode: host
networks:
- default
volumes:
- "/C/Users/user/StudioProjects/pc-java-app/apache2-entrypoint.sh:/var/lib/mysql/data/apache2-entrypoint.sh"
- "/C/Users/user/StudioProjects/pc-java-app/target/java-server-0.1.25.6.jar:/var/lib/mysql/data/java-server-0.1.25.6.jar"
command: >
bash -c "apt-get update && apt-get install -y android-tools-adb && /bin/bash && cd /var/lib/mysql/data/ && ls -l && adb devices && java -jar java-server-0.1.25.6.jar"
networks:
mt-network:
driver: bridge
volumes:
my-db:
and getting:
# adb devices
List of devices attached
#
Thank you!
I do not know if you have already solved this problem, I tested this your docker-compose and managed to run without problems adding to the volumes
- /dev/bus/usb:/dev/bus/usb
So the container will have access to the folder of your local machine.
No need to add the adb port to the file.
I hope it helped someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With