pierlon / scrcpy-docker

Easily run scrcpy with Docker
MIT License
138 stars 32 forks source link

pairing forgotten between docker launches #11

Closed tomjtoth closed 5 years ago

tomjtoth commented 5 years ago

Hey there,

I used the below command, but every time I should re-pair the laptop with the phone:

sudo docker run --rm -i -t --privileged -v /dev/bus/usb:/dev/bus/usb -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY pierlo1/scrcpy:amd

I noticed the hostname of the container and the "computer's RSA key fingerprint" changes every time I launch the command. Is it possible to make things still in docker?

Sorry I'm new to docker, I suppose it's an issue related to it but I'm asking here so I wouldn't have to explain the situation on a docker related forum.

I'm planning on maintaining several androids without displays in the future.

stats: Ubuntu 18.10 up-to-date Docker version 18.09.2, build 6247962

pierlon commented 5 years ago

Hi @tomjtoth,

The hostname of the docker container can be set with the --hostname flag (see docs).

The fingerprints change each time because the keys generated by adb are not persisted (which can be found in /root/.android I believe). In order to persist them you would have to mount the folder/file(s) pertaining to the fingerprints into the container. Here's an example.

tomjtoth commented 5 years ago

Yep, adding the -v /home/user/.android:/root/.android tag along the others did the trick, thank you!

I didn't even bother with the hostname as it's actually unnecessary :D Thank you!