HQarroum /docker-android

🤖 A minimal and customizable Docker image running the Android emulator as a service.

★ 7,393⑂ 577👁 38⑃ 15● 17▤ 0
ShellCreated 2023-02-08
7,393
stars
+0+3+75
577
forks
38
watchers
15
prs
17
issues
0
releases
–
discussions

README

docker-android
 A minimal and customizable Docker image running the Android emulator as a service.



!Docker Pulls

Current version: 1.1.0

 📋 Table of contents

- Features
- Description
- Usage
- See also

 🔖 Features

- Minimal Alpine based image bundled with the Android emulator and KVM support.
- Bundles the Java Runtime Environment 11 in the image.
- Customizable Android version, device type and image types.
- Port-forwarding of emulator and ADB on the container network interface built-in.
- Emulator images are wiped each time the emulator re-starts.
- Runs headless, suitable for CI farms. Compatible with scrcpy to remotely control the Android screen.

 🔰 Description

The 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.

You 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.

Variant                   |   Uncompressed   |  Compressed  |
------------------------- | ---------------- | ------------ |
API 33 + Emulator         |      5.84 GB     |    1.97 GB   |
API 32 + Emulator         |      5.89 GB     |    1.93 GB   |
API 28 + Emulator         |      4.29 GB     |    1.46 GB   |
Without SDK and emulator  |      414 MB      |    138 MB    |

 📘 Usage

By default, a build will bundle the Android SDK, platform tools and emulator with the image.

with docker-compose:

bash
docker compose up android-emulator


or with GPU acceleration
bash
docker compose up android-emulator-cuda


or for example with GPU acceleration and google playstore
bash
docker compose up android-emulator-cuda-store


with only docker


bash
docker build -t android-emulator .


 Keys

To run google_apis_playstore image, you need to have same adbkey between emulator and client.

You can generate one by running adb keygen adbkey, that generates 2 files - adbkey and adbkey.pub.

override them inside ./keys directory.

 Running the container

Once the image is built, you can mount your KVM driver on the container and expose its ADB port.

 Ensure 4GB of memory and at least 8GB of disk space for API 33.

bash
docker run -it --rm --device /dev/kvm -p 5555:5555 android-emulator


 Save data/storage after restart (wipe)

All avd save in docker dir /data, name for avd is android

bash
docker run -it --rm --device /dev/kvm -p 5555:5555 -v ~/android_avd:/data android-emulator


 Connect ADB to the container

The 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.

bash
adb connect 1

Snapshot: 2026-11-04T14:00:00Z · Data license Apache-2.0 · JSON