@amiaoapp: 如果这类项目继续发展下去,“手机”这个概念可能真的会消失。我们未来用的,可能根本不是“手机”,而是“运行在云上的 Android 实例”。 docker-android 做了一件很反常识的事:把完整 Android 系统,直接塞进 Doc…
摘要
该帖子介绍了 docker-android 项目,它将完整的 Android 系统打包进 Docker 容器,让 Android 可以作为一种云服务运行,挑战了手机作为硬件的传统概念。
查看缓存全文
缓存时间: 2026/06/27 09:53
如果这类项目继续发展下去,“手机”这个概念可能真的会消失。我们未来用的,可能根本不是“手机”,而是“运行在云上的 Android 实例”。
docker-android 做了一件很反常识的事:把完整 Android 系统,直接塞进 Docker 容器里运行。
不是简化版,不是模拟器壳子,而是: Android Emulator + ADB + QEMU + libvirt 的完整组合
结果一个“手机环境”,变成了一个可以部署的服务。
更夸张的是它的体积:Android API 33:约 1.97GB,API 28:约 1.46GB,极限精简后:138MB
一个“手机操作系统”,可以小到接近一个轻量服务镜像。 它带来的变化不是技术,而是定义层面的: Android 不再绑定设备 手机不再是“硬件形态” 操作系统开始变成“云端服务”
你甚至可以在服务器上直接: 跑 Android App 做自动化批量测试 远程控制 UI 构建虚拟设备集群
真正值得讨论的是这一点 当手机系统可以被容器化部署,那“手机厂商”的护城河还剩什么?
https://github.com/HQarroum/docker-android… #Android #Docker #云计算 #开源 #技术思考
HQarroum/docker-android
Source: https://github.com/HQarroum/docker-android
docker-android
A minimal and customizable Docker image running the Android emulator as a service.
Current version: 1.1.0
📋 Table of contents
🔖 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
scrcpyto 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:
docker compose up android-emulator
or with GPU acceleration
docker compose up android-emulator-cuda
or for example with GPU acceleration and google playstore
docker compose up android-emulator-cuda-store
with only docker
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.
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
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.
adb connect 127.0.0.1:5555
Additionally, you can use scrcpy to control the screen of the emulator remotely. To do so, you simply have to connect ADB and run it locally.
By default, the emulator runs with a Pixel preset (1080x1920).
scrcpy
|
|
|
Customize the image
It is possible to customize the API level (Android version) and the image type (Google APIs vs PlayStore) when building the image.
By default, the image will build with API 33 with support for Google APIs for an x86_64 architecture.
This 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.
API_LEVEL- Specifies the API level associated with the image. Use this parameter to change the Android version.IMG_TYPE- Specifies the type of image to install.ARCHITECTURESpecifies the CPU architecture of the Android image. Note that onlyx86_64andx86are actively supported by this image.
The below example will install Android Pie with support for the Google Play Store.
docker build \
--build-arg API_LEVEL=28 \
--build-arg IMG_TYPE=google_apis_playstore \
--build-arg ARCHITECTURE=x86 \
--tag android-emulator .
Variables
Default variables
Disable animation
DISABLE_ANIMATION=false
Disable hidden policy
DISABLE_HIDDEN_POLICY=false
Skip adb authentication
SKIP_AUTH=true
Memory for emulator
MEMORY=8192
Cores for emulator
CORES=4
Extra flags to emulator
EXTRA_FLAGS=“-no-metrics -no-audio -partition-size=8192”
Mount an external drive in the container
It 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.
To do so, you can specify a specific argument at build time to disable the download and installation of the SDK in the image.
docker build -t android-emulator --build-arg INSTALL_ANDROID_SDK=0 .
You will need mount the SDK in the container at
/opt/android.
docker run -it --rm --device /dev/kvm -p 5555:5555 -v /shared/android/sdk:/opt/android/ android-emulator
Pull from Docker Hub
Different pre-built images of docker-android exist on Docker Hub. 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.
docker pull halimqarroum/docker-android:api-33
👀 See also
- The alpine-android project which is based on a different Alpine image.
- The docker-android project which offers a WebRTC interface to an Android emulator.
相似文章
@HowToPrompt__: 有人开源了一个工具,可以在Docker容器内运行整个Android手机。100%开源。
一款开源工具已发布,可以在Docker容器内运行整个Android手机。
@1YES_yes1: 苹果终于对 Docker 动手了。 现在 AI Coding 火了之后,越来越多人开始在 Mac 本地跑容器,部署各种 Agent 后端。 但有一件事,很多人都忍很久了。 Docker Desktop 真的太重了。 启动慢,占资源高,风扇…
苹果在 GitHub 开源了官方容器工具 Container,使用 Swift 重写并针对 Apple Silicon 优化,比 Docker Desktop 更轻更快,支持直装和兼容 Docker 命令。
@QingQ77: 让 AI 自动操控真实 Android 手机,执行社交、调研、内容运营等长时段移动端任务 https://github.com/Core-Mate/OpenGUI… OpenGUI 是个 AI 手机操控系统,AI 直接在你的 Androi…
OpenGUI 是一个开源 AI 手机操控系统,让 AI 自动操控真实 Android 设备执行社交、调研等长时段移动端任务,支持通过飞书、Telegram、Discord 或 REST API 远程派发任务,底层架构分为 Plan Supervisor 和 Executor Graph 两层,支持 Claude、Qwen、豆包等多种模型。
@bkdgiffug: 别急着扔掉抽屉里积灰的旧安卓手机。安装Termux,然后运行一个开源方案——
本项目提供脚本,通过Termux将旧安卓手机改造成Linux桌面或智能家居服务器,无需Root权限或电脑。
@alexgiantwhale: https://x.com/alexgiantwhale/status/2079342482593309022
一篇详细介绍如何从零搭建 Dev Container 的技术文章,包括编写 Dockerfile、devcontainer.json、配置安全选项和生命周期命令,以固化 Go 开发环境并限制容器权限。