Docker image to run scrcpy.
Before running the image, Docker must be allowed to connect to the X server:
xhost + local:docker
A separate image has been built for AMD, Intel, & Nvidia graphics hardwares.
To get the image for your hardware, simply append :<graphics type>
to the image name (pierlo1/scrcpy
) where graphics type can be:
- amd
- intel
- nvidia
For example: pierlo1/scrcpy:amd
.
To run the image with Docker run:
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:<graphics type>
To run with Docker Compose, set the SCRCPY_GRAPHICS_TYPE
environment variable to one of the graphics types mentioned earlier.
For persistence, make a copy of .env.example
, name it .env
, and configure it.
Once done, run the command:
docker-compose run --rm scrcpy
The scrcpy_adb_keys
volume is used to preserve the adb
authorization keys.
Inside the container, verify you can see your Android device with:
adb devices
Note: make sure the adb daemon is not running on the host (adb kill-server
) to view devices in the container.
And finally, run scrcpy
:
scrcpy [options]