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!