A small Docker image that runs an Android Debug Bridge (adb) server, giving you access to platform tools such as adb and fastboot from inside a container.
This repository is a fork of tiiuae/adb-docker, which itself derives from sorccu/adb. It is based on Alpine to keep the image small and adds an entrypoint that starts the ADB server and sets up reverse port forwarding (
tcp:9696andtcp:4223) automatically once a device connects.
ghcr.io/mrmeganova/adb-docker:latest
Pull it with:
docker pull ghcr.io/mrmeganova/adb-docker:latestThe container needs access to the host's USB bus to talk to a physical device:
- It must run with
--privileged. - The host's
/dev/bus/usbmust be mounted into the container.
Start the ADB server and expose it on the host:
docker run -d --privileged \
-v /dev/bus/usb:/dev/bus/usb \
-p 5037:5037 \
--name adbd \
ghcr.io/mrmeganova/adb-docker:latestPlug in your device, then list it:
docker exec adbd adb devicesYou should see something like:
List of devices attached
0123456789ABCDEF device
docker run --rm --privileged \
-v /dev/bus/usb:/dev/bus/usb \
ghcr.io/mrmeganova/adb-docker:latest \
adb devicesdocker exec -it adbd adb shelldocker run --rm --privileged \
-v /dev/bus/usb:/dev/bus/usb \
-v "$PWD:/apks" \
ghcr.io/mrmeganova/adb-docker:latest \
adb install /apks/app.apkWith the server running and 5037 published (see Quick start), point a remote adb client at the host:
adb -H <server-ip> -P 5037 devicesThe image ships with a built-in RSA key so you don't have to authorize a new key on the device every time the container starts. This is convenient, but it means anyone holding that key can reach your device over ADB. To use your own key instead, mount your key folder over /root/.android:
docker run -d --privileged \
-v /dev/bus/usb:/dev/bus/usb \
-v /your/key_folder:/root/.android \
-p 5037:5037 \
--name adbd \
ghcr.io/mrmeganova/adb-docker:latestThe scripts/ folder contains debloat and configuration scripts for Android devices (TV and smartphone), meant to be run through this container. See scripts/README.md for details.
Sample systemd units are provided in the systemd/ folder to run the daemon as a managed service. Copy them to /etc/systemd/system/, then:
systemctl enable --now adbdRun systemctl daemon-reload after editing any unit.
See LICENSE.