HQarroum / docker-android
Summary
The `docker-android` project provides a minimal, customizable Docker image designed to run the Android emulator as a service. This current version 1.1.0 image is Alpine Linux-based, includes Java Runtime Environment 11, and supports KVM. It focuses on size optimization by bundling only essential software like the Android emulator, an ADB server, and QEMU with `libvirt` support. Users can customize the Android version (API level), device type, and image type during the build process, with default settings for API 33 and Google APIs on x86_64. The image runs headless, making it suitable for CI environments, and is compatible with `scrcpy` for remote control. Build variants range from 414 MB (uncompressed, without SDK/emulator) to 5.89 GB (API 32 + Emulator).
Key takeaway
For DevOps Engineers managing Android CI/CD pipelines, this `docker-android` image offers a streamlined solution for running emulators. You can significantly reduce build times and image sizes by disabling SDK installation and mounting an external SDK. Customize API levels and image types to test applications across various Android versions efficiently. Ensure your host machine has at least 4GB of memory and 8GB of disk space for API 33 images.
Key insights
A Docker image provides a minimal, customizable Android emulator for CI/CD and remote control.
Principles
- Optimize image size by including only essential components.
- Support headless operation for CI/CD integration.
Method
Build the Docker image with specified API_LEVEL, IMG_TYPE, and ARCHITECTURE arguments, then run it with KVM device and ADB port exposed.
In practice
- Use `docker compose up android-emulator-cuda` for GPU acceleration.
- Mount `~/android_avd:/data` to persist emulator data across restarts.
- Connect via `adb connect 127.0.0.1:5555` and `scrcpy` for remote control.
Topics
- Docker
- Android Emulator
- CI/CD
- Mobile Testing
- KVM Virtualization
Code references
Best for: Software Engineer, DevOps Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Github Trending: All languages.