Host configuration
Follow the steps below to ensure your host system is properly configured to mount the smartphone inside the container.-
Make sure you’ve completed the prerequisite steps in the Quickstart. Then verify the ADB connection with
adb devices. This should list your phone as “device” along with its Serial Number. If the phone appears asunauthorizedmake sure to accept the prompt on your phone. -
Confirm that the ADB keys have been correctly created. Check for an
.androidfolder under your$HOMEdirectory that contains:adb.5037,adbkey, andadbkey.pub. -
Set up a custom rule to uniquely identify your phone and map it to a static path:
-
Open a terminal and find your device’s
idVendorandidProductusing thelsusbcommand. In the example below, theidVendorandidProductare18d1and4ee2, respectively. -
Create a new file (sudo may be required) under
/etc/udev/rules.dand name it51-android.rules. -
Add the following content and save the file:
where
XXXX,YYYY, andSSSSare the vendor ID, product ID, and serial number of your phone. This static mapping is required because otherwise the phone’s mount path will change across reconnections! -
Reload the rules
-
Open a terminal and find your device’s
-
Kill the ADB server on the host so that the container can actually detect the phone:
Usage
Pull the image from the GitHub Container Registry:| Docker option | What it does | Why it matters for Droidrun |
|---|---|---|
--group-add plugdev | Adds the host user to the container’s plugdev group. | Gives the container permission to access USB devices (e.g., your Android phone) without requiring root. |
--device /dev/phone1/phone:/dev/phone | Maps a specific USB device file from the host into the container. Thanks to our udev rule, the phone will always be mapped here. | Allows Droidrun to see the phone as /dev/phone inside the container, so it can communicate with the device. |
--volume /dev/bus/usb:/dev/bus/usb | Mounts the entire USB bus directory. | Provides access to all connected USB devices, enabling Droidrun to discover and interact with the phone. |
--volume ~/.android:/home/droidrun/.android | Mounts the host’s Android configuration directory into the container. | Stores ADB keys and settings so that once you grant permission on the host, Droidrun doesn’t prompt for it again inside the container. |
droidrun entrypoint, which means you can use any of the CLI commands described in the CLI Usage section and append it to the following base command:
Setup the Portal APK
Simply run the container with thesetup CLI command.
Verify the setup
Simply run the container with theping CLI command.
Run some agents
Now you’re ready to control your device using Docker and natural language:Troubleshooting
-
Error response from daemon
If you enconter the following error:
it usually indicates one of two things:
- The phone isn’t mounted at the expected custom path. Verify that
/dev/phone1/phoneexists. - An ADB server is still running on the host. Stop it with
adb kill-server.
- The phone isn’t mounted at the expected custom path. Verify that
Next Steps
- CLI Usage - Dive into the various parameters and start building your own projects with the docker!