{"id":13562729,"url":"https://github.com/HMaker/docker-adb","last_synced_at":"2025-04-03T19:31:23.773Z","repository":{"id":183773033,"uuid":"486001103","full_name":"HMaker/docker-adb","owner":"HMaker","description":"Run ADB server on Docker containers.","archived":false,"fork":false,"pushed_at":"2022-04-27T01:17:35.000Z","size":4,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-04T15:51:01.127Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HMaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-04-27T01:14:43.000Z","updated_at":"2024-08-14T22:43:00.000Z","dependencies_parsed_at":"2023-07-25T20:07:51.535Z","dependency_job_id":null,"html_url":"https://github.com/HMaker/docker-adb","commit_stats":null,"previous_names":["hmaker/docker-adb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMaker%2Fdocker-adb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMaker%2Fdocker-adb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMaker%2Fdocker-adb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMaker%2Fdocker-adb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HMaker","download_url":"https://codeload.github.com/HMaker/docker-adb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247065210,"owners_count":20877730,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:01:11.697Z","updated_at":"2025-04-03T19:31:23.461Z","avatar_url":"https://github.com/HMaker.png","language":"Dockerfile","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"## docker-adb\nRun ADB server on Docker containers with access to host's USB devices. This dockerfile uses [android-tools][1] to build ADB server without all the bloat of AOSP. \n\nTested on **Ubuntu** 20+ hosts only.\n\n## Usage\nOn host system it's needed to give USB devices access to plugdev group, for that create a new udev rule at `/etc/udev/rules.d/51-android.rules`:\n```\n# LG\nSUBSYSTEM==\"usb\", ATTR{idVendor}==\"1004\", MODE=\"0660\", GROUP=\"plugdev\"\n# SAMSUNG\nSUBSYSTEM==\"usb\", ATTR{idVendor}==\"04e8\", MODE=\"0660\", GROUP=\"plugdev\"\n# ...\n```\nwhere you need a new rule for each smartphone vendor you have. Then reload udev rules with `sudo udevadm control --reload-rules \u0026\u0026 sudo udevadm trigger`.\n\nCreate a new group `adb` with `sudo groupadd -r adb` and append the following env vars to `~/.bashrc` (or `~/.zshrc`):\n```bash\nexport PLUGDEV_GID=$(getent group plugdev | cut -d: -f3)\nexport ADB_GID=$(getent group adb | cut -d: -f3)\n```\nthen reload bashrc with `source ~/.bashrc`.\n\nBuild the Docker image with:\n```bash\ngit clone https://github.com/HMaker/docker-adb.git\ncd docker-adb\ndocker build -t adbserver .\n```\nYou can target different releases of android-tools with `--build-arg RELEASE=X` where `X` is the release version number found at their [releases page][2]. \n\nAfter the image is successfully built, you can create a new adb container with:\n```bash\nmkdir adbkeys\nln -sr \u003cADB_PRIVATE_KEY_FILE\u003e adbkeys/adbkey\nln -sr \u003cADB_PUBLIC_KEY_FILE\u003e adbkeys/adbkey.pub\nchown :adb \u003cADB_PRIVATE_KEY_FILE\u003e \u003cADB_PUBLIC_KEY_FILE\u003e\nchmod g=r \u003cADB_PRIVATE_KEY_FILE\u003e \u003cADB_PUBLIC_KEY_FILE\u003e\ndocker run -d \\\n    -v ./adbkeys/adbkey:/home/adb/.android/adbkey \\\n    -v ./adbkeys/adbkey.pub:/home/adb/.android/adbkey.pub \\\n    -v /dev/bus/usb:/dev/bus/usb \\\n    -v /run/udev:/run/udev:ro \\\n    --device-cgroup-rule \"c 188:* rmw\" \\\n    --device-cgroup-rule \"c 189:* rmw\" \\\n    --group-add $PLUGDEV_GID \\\n    --group-add $ADB_GID \\\n    --name adb \\\n    adbserver\n```\nwhere `\u003cADB_PRIVATE_KEY_FILE\u003e` is the path to ADB public key file and `\u003cADB_PRIVATE_KEY_FILE\u003e` to the private key file, they are commonly found at `~/.android/adbkey` and `~/.android/adbkey.pub` respectively. If you don't have already generated keys you can skip these steps and let ADB generate new keys within the container, but these keys will be regenerated every time the container is recreated and you will need to authorize new debugging clients on your smartphone.\n\nYou also can start adb container with compose: `docker-compose up -d adb`.\n\nThat's it, you have a non-root ADB server container! You can get a shell with `docker exec adb bash` and use ADB client to inspect devices (e.g. `adb devices`). You also can use `lsusb` to check if underlying USB device for your smartphone is available.\n\n## Debugging\nTo troubleshoot issues you may use a debug build of ADB server, the `Dockerfile.debug` dockerfile builds a debug environment with debug build of ADB and the GDB debugger ready to be used.\n\n\u003cbr\u003e\n\u003chr\u003e\ndocker-adb is licensed under the MIT License.\n\u003chr\u003e\n\n[1]: https://github.com/nmeum/android-tools\n[2]: https://github.com/nmeum/android-tools/releases","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHMaker%2Fdocker-adb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHMaker%2Fdocker-adb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHMaker%2Fdocker-adb/lists"}