{"id":17464552,"url":"https://github.com/hqarroum/docker-android","last_synced_at":"2025-04-19T18:24:53.458Z","repository":{"id":141119255,"uuid":"599118825","full_name":"HQarroum/docker-android","owner":"HQarroum","description":"🤖 A minimal and customizable Docker image running the Android emulator as a service.","archived":false,"fork":false,"pushed_at":"2024-05-02T15:12:26.000Z","size":552,"stargazers_count":126,"open_issues_count":7,"forks_count":26,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T11:41:29.166Z","etag":null,"topics":["android","android-emulator","ci-pipeline","docker","docker-android"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/HQarroum.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-08T13:48:21.000Z","updated_at":"2025-03-28T11:15:13.000Z","dependencies_parsed_at":"2024-02-20T19:27:40.008Z","dependency_job_id":"64786cf1-c875-4655-9225-62af7c0db48d","html_url":"https://github.com/HQarroum/docker-android","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HQarroum%2Fdocker-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HQarroum%2Fdocker-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HQarroum%2Fdocker-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HQarroum%2Fdocker-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HQarroum","download_url":"https://codeload.github.com/HQarroum/docker-android/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249762390,"owners_count":21321928,"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":["android","android-emulator","ci-pipeline","docker","docker-android"],"created_at":"2024-10-18T10:46:16.898Z","updated_at":"2025-04-19T18:24:53.407Z","avatar_url":"https://github.com/HQarroum.png","language":"Shell","readme":"\u003cbr /\u003e\u003cbr /\u003e\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"400\" src=\"assets/icon.png\" /\u003e\n\u003c/p\u003e\u003cbr /\u003e\u003cbr /\u003e\n\n# docker-android\n\u003e A minimal and customizable Docker image running the Android emulator as a service.\n\n[![Docker Image CI](https://github.com/HQarroum/docker-android/actions/workflows/docker-image.yml/badge.svg)](https://github.com/HQarroum/docker-android/actions/workflows/docker-image.yml)\n[![DeepSource](https://deepsource.io/gh/HQarroum/docker-android.svg/?label=active+issues\u0026show_trend=true\u0026token=JTfGSHolIiMj0WNfv2ES0I6X)](https://deepsource.io/gh/HQarroum/docker-android/?ref=repository-badge)\n![Docker Pulls](https://img.shields.io/docker/pulls/halimqarroum/docker-android)\n\nCurrent version: **1.1.0**\n\n## 📋 Table of contents\n\n- [Features](#-features)\n- [Description](#-description)\n- [Usage](#-usage)\n- [See also](#-see-also)\n\n## 🔖 Features\n\n- Minimal Alpine based image bundled with the Android emulator and KVM support.\n- Bundles the Java Runtime Environment 11 in the image.\n- Customizable Android version, device type and image types.\n- Port-forwarding of emulator and ADB on the container network interface built-in.\n- Emulator images are wiped each time the emulator re-starts.\n- Runs headless, suitable for CI farms. Compatible with [`scrcpy`](https://github.com/Genymobile/scrcpy) to remotely control the Android screen.\n\n## 🔰 Description\n\nThe focus of this project is to provide a size-optimized Docker image bundled with the minimal amount of software required to expose a fully functionning Android emulator that's remotely controllable over the network. This image only contains the Android emulator itself, an ADB server used to remotely connect into the emulator from outside the container, and QEMU with `libvirt` support.\n\nYou can build this image without the Android SDK and without the Android emulator to make the image smaller. Below is a size comparison between some of the possible build variants.\n\nVariant                   |   Uncompressed   |  Compressed  |\n------------------------- | ---------------- | ------------ |\nAPI 33 + Emulator         |      5.84 GB     |    1.97 GB   |\nAPI 32 + Emulator         |      5.89 GB     |    1.93 GB   |\nAPI 28 + Emulator         |      4.29 GB     |    1.46 GB   |\nWithout SDK and emulator  |      414 MB      |    138 MB    |\n\n## 📘 Usage\n\nBy default, a build will bundle the Android SDK, platform tools and emulator with the image.\n\nwith docker-compose:\n\n```bash\ndocker compose up android-emulator\n```\n\nor with GPU acceleration\n```bash\ndocker compose up android-emulator-cuda\n```\n\nor for example with GPU acceleration and google playstore\n```bash\ndocker compose up android-emulator-cuda-store\n```\n\nwith only docker\n\n\n```bash\ndocker build -t android-emulator .\n```\n\n## Keys\n\nTo run google_apis_playstore image, you need to have same adbkey between emulator and client.\n\nYou can generate one by running `adb keygen adbkey`, that generates 2 files - adbkey and adbkey.pub.\n\noverride them inside ./keys directory.\n\n### Running the container\n\nOnce the image is built, you can mount your KVM driver on the container and expose its ADB port.\n\n\u003e Ensure 4GB of memory and at least 8GB of disk space for API 33.\n\n```bash\ndocker run -it --rm --device /dev/kvm -p 5555:5555 android-emulator\n```\n\n### Save data/storage after restart (wipe)\n\nAll avd save in docker dir `/data`, name for avd is `android`\n\n```bash\ndocker run -it --rm --device /dev/kvm -p 5555:5555 -v ~/android_avd:/data android-emulator\n```\n\n### Connect ADB to the container\n\nThe ADB server in the container will be spawned automatically and listen on all interfaces in the container. After a few seconds, once the kernel has booted, you will be able to connect ADB to the container.\n\n```bash\nadb connect 127.0.0.1:5555\n```\n\nAdditionally, you can use [`scrcpy`](https://github.com/Genymobile/scrcpy) to control the screen of the emulator remotely. To do so, you simply have to connect ADB and run it locally.\n\n\u003e By default, the emulator runs with a Pixel preset (1080x1920).\n\n```bash\nscrcpy\n```\n\n\u003cbr /\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n      \u003cimg width=\"260\" src=\"assets/screenshot.png\" /\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      \u003cimg width=\"260\" src=\"assets/screenshot-2.png\" /\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      \u003cimg width=\"260\" src=\"assets/screenshot-3.png\" /\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\u003cbr /\u003e\n\n### Customize the image\n\nIt is possible to customize the API level (Android version) and the image type (Google APIs vs PlayStore) when building the image.\n\n\u003e By default, the image will build with API 33 with support for Google APIs for an x86_64 architecture.\n\nThis can come in handy when integrating multiple images as part of a CI pipeline where an application or a set of applications need to be tested against different Android versions. There are 2 variables that can be specified at build time to change the Android image.\n\n- `API_LEVEL` - Specifies the [API level](https://apilevels.com/) associated with the image. Use this parameter to change the Android version.\n- `IMG_TYPE` - Specifies the type of image to install.\n- `ARCHITECTURE` Specifies the CPU architecture of the Android image. Note that only `x86_64` and `x86` are actively supported by this image.\n\nThe below example will install Android Pie with support for the Google Play Store.\n\n```bash\ndocker build \\\n  --build-arg API_LEVEL=28 \\\n  --build-arg IMG_TYPE=google_apis_playstore \\\n  --build-arg ARCHITECTURE=x86 \\\n  --tag android-emulator .\n```\n\n### Variables\n#### Default variables\n\n#### Disable animation\nDISABLE_ANIMATION=false\n\n#### Disable hidden policy\nDISABLE_HIDDEN_POLICY=false\n\n#### Skip adb authentication\nSKIP_AUTH=true\n\n#### Memory for emulator\nMEMORY=8192\n\n#### Cores for emulator\nCORES=4\n\n### Mount an external drive in the container\n\nIt might be sometimes useful to have the entire Android SDK folder outside of the container (stored on a shared distributed filesystem such as NFS for example), to significantly reduce the size and the build time of the image.\n\nTo do so, you can specify a specific argument at build time to disable the download and installation of the SDK in the image.\n\n```bash\ndocker build -t android-emulator --build-arg INSTALL_ANDROID_SDK=0 .\n```\n\n\u003e You will need mount the SDK in the container at `/opt/android`.\n\n```bash\ndocker run -it --rm --device /dev/kvm -p 5555:5555 -v /shared/android/sdk:/opt/android/ android-emulator\n```\n\n### Pull from Docker Hub\n\nDifferent pre-built images of `docker-android` exist on [Docker Hub](https://hub.docker.com/r/halimqarroum/docker-android). Each image variant is tagged using its the api level and image type. For example, to pull an API 33 image, you can run the following.\n\n```bash\ndocker pull halimqarroum/docker-android:api-33\n```\n\n## 👀 See also\n\n- The [alpine-android](https://github.com/alvr/alpine-android) project which is based on a different Alpine image.\n- The [docker-android](https://github.com/budtmo/docker-android) project which offers a WebRTC interface to an Android emulator.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhqarroum%2Fdocker-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhqarroum%2Fdocker-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhqarroum%2Fdocker-android/lists"}