-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connect to specific device after startup #48
Comments
+1 for this, very useful feature. We probably want the |
My first thought is to use |
i wrote a script which wraps the original container entrypoint - works fine |
Ummmm... @koral-- how come this is closed? I don't feel this was solved. @benedikt-bartscher - could you share the script? |
I answered here: #48 (comment) |
@koral-- but this is merely doing this manually. This is not a solution and not even a workaround... |
OK got it. |
@GuyKh it's not perfect but it works .env
docker-compose.yml adb:
container_name: adb
image: devicefarmer/adb:latest@sha256:ad5ac763b6d9f45650b5463b916cfc79ab624268533b9c92632368ec743e18a4
restart: unless-stopped
command: /adb-entrypoint.sh
environment:
- ADB_HOSTS=${ADB_HOSTS}
volumes:
- "/dev/bus/usb:/dev/bus/usb"
- "./adb/android:/root/.android/"
- "./adb/adb-connect.sh:/adb-connect.sh"
- "./adb/adb-entrypoint.sh:/adb-entrypoint.sh"
privileged: true adb-entrypoint.sh #!/bin/sh
# runs adb.sh in background and then runs the initial entrypoint of docker-adb
# run adb.sh which periodically connects to our devices (ADB_HOSTS) in the background
./adb-connect.sh &
# original entrypoint from Dockerfile (https://github.com/DeviceFarmer/docker-adb/blob/master/Dockerfile)
# CMD ["adb", "-a", "-P", "5037", "server", "nodaemon"]
adb -a -P 5037 server nodaemon adb-connect.sh #!/bin/sh
echo "Waiting for adb server to start"
sleep 10
echo "Starting adb connect script"
# infinite loop which runs `adb connect` for all entries in ADB_HOSTS
while true; do
for host in $ADB_HOSTS; do
echo "Connecting to $host"
adb connect "$host"
done
sleep 30
done
|
A question, more than an issue.
Currently, I'm starting the container via
docker-compose
:But every time afterwards, I have to run this to connect to
192.168.1.123
Is there a way to run a command after the container is up so I wouldn't have to do it manually?
The text was updated successfully, but these errors were encountered: