docker-android README

项目的 README,来自 github.com/budtmo/docker-android。合并为一个 markdown 文件:README.md。

Paypal Donate PRs Welcome codecov Join the chat at https://gitter.im/budtmo/docker-android GitHub release

Docker-Android is a docker image built to be used for everything related to Android. It can be used for Application development and testing (native, web and hybrid-app).

Sponsors

WebShare

Webshare offers premium residential, ISP, and datacenter proxies at the lowest prices, with HTTP(S) and SOCKS5 support. 80M+ IPs in 195 countries, a 99.97% success rate, and 10 free proxies to start (no card required). Get 20% off your first purchase with code BUDTMO20. Try this now!.

ProxySeller

Proxy-Seller gives you reliable proxy infrastructure for any workflow: private residential, mobile (4G/5G/LTE), ISP, and datacenter IPv4/IPv6 proxies, all with HTTP(S) and SOCKS5 support. Tap into 47M+ residential IPs across 220+ locations, target exactly the country, city, or ISP you need, and count on 99.7% uptime backed by 24/7 support. Get 15% off with promo code BUDTMO.

Advantages of using this project

  1. Emulator with different device profile and skins, such as Samsung Galaxy S6, LG Nexus 4, HTC Nexus One and more.
  2. Support vnc to be able to see what happen inside docker container
  3. Support log sharing feature where all logs can be accessed from web-UI
  4. Ability to control emulator from outside container by using adb connect
  5. Integrated with other cloud solutions, e.g. Genymotion Cloud
  6. It can be used to build Android project
  7. It can be used to run unit and UI-Test with different test-frameworks, e.g. Appium, Espresso, etc.
  8. It support (http) docker-android MCP-Server (beta-version)
  9. It support Appium MCP
  10. It support AI-Agent (beta-version) - supported local-LLM server: Ollama, VLLM

List of Docker-Images

Android API Usage Type Image with latest release version Image with specific release version
11.0 30 Development budtmo/docker-android:emulator_11.0 budtmo/docker-android:emulator_11.0_
12.0 32 Development budtmo/docker-android:emulator_12.0 budtmo/docker-android:emulator_12.0_
13.0 33 Development budtmo/docker-android:emulator_13.0 budtmo/docker-android:emulator_13.0_
14.0 34 Development budtmo/docker-android:emulator_14.0 budtmo/docker-android:emulator_14.0_
11.0 30 Production-like budtmo/docker-android:emulator_playstore_11.0 budtmo/docker-android:emulator_playstore_11.0_
12.0 32 Production-like budtmo/docker-android:emulator_playstore_12.0 budtmo/docker-android:emulator_playstore_12.0_
13.0 33 Production-like budtmo/docker-android:emulator_playstore_13.0 budtmo/docker-android:emulator_playstore_13.0_
14.0 34 Production-like budtmo/docker-android:emulator_playstore_14.0 budtmo/docker-android:emulator_playstore_14.0_
- - - budtmo/docker-android:genymotion budtmo/docker-android:genymotion_
- - - budtmo/docker-android:mcp budtmo/docker-android:mcp_

List of Devices

Type Device Name
Phone Samsung Galaxy S10
Phone Samsung Galaxy S9
Phone Samsung Galaxy S8
Phone Samsung Galaxy S7 Edge
Phone Samsung Galaxy S7
Phone Samsung Galaxy S6
Phone Nexus 4
Phone Nexus 5
Phone Nexus One
Phone Nexus S
Tablet Nexus 7
Tablet Pixel C

Requirements

  1. Docker is installed on your system.

Quick Start

  1. If you use Ubuntu OS on your host machine, you can skip this step. For OSX and Windows OS user, you need to use Virtual Machine that support Virtualization with Ubuntu OS because the image can be run under Ubuntu OS only.

  2. Your machine should support virtualization. To check if the virtualization is enabled is:

    sudo apt install cpu-checker
    kvm-ok
    
  3. Run Docker-Android container

    docker run -d -p 6080:6080 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true --device /dev/kvm --name android-container budtmo/docker-android:emulator_14.0
    
  4. Open http://localhost:6080 to see inside running container.

  5. To check the status of the emulator

    docker exec -it android-container cat device_status
    

Using Nvidia GPU

  1. Make sure you have already installed and configured all needed nvidia components, e.g. nvidia-smi

  2. Run Docker-Android container

    docker run -d -p 6080:6080 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true -e EMULATOR_GPU=host -e NVIDIA_DRIVER_CAPABILITIES=all --device /dev/kvm --gpus all --name android-container budtmo/docker-android:emulator_14.0
    
  3. Make sure that Nvidia GPU is used

    docker exec -it android-container adb shell dumpsys SurfaceFlinger | grep -i GLES
    

Note: With EMULATOR_GPU=host on NVIDIA, the emulator renders on the GPU and runs headless, but its screen is black. Android works normally, so ADB, Appium and tests are unaffected. However, Some of Android's screen-composition shaders fail to compile on that path, so every captured frame is black. This affects noVNC, scrcpy, screencap, screenrecord and Appium screenshots.

Using AMD or Intel GPU

  1. Make sure the host has a working Mesa driver (amdgpu/i915) and a render node, e.g. ls -l /dev/dri/renderD128

  2. Run Docker-Android container, passing the render node and its group so that the emulator user can open it

    docker run -d -e EMULATOR_DEVICE="Samsung Galaxy S10" -e EMULATOR_GPU=host --device /dev/kvm --device /dev/dri/renderD128 --group-add $(stat -c %g /dev/dri/renderD128) --name android-container budtmo/docker-android:emulator_14.0
    
  3. Make sure that the GPU is used

    docker exec -it android-container grep "Selecting Vulkan device" /home/androidusr/logs/device.stdout.log
    

The emulator runs headless (-no-window), so noVNC does not show it, but ADB, Appium and screencap screenshots work. Tested with an AMD Radeon RX 5700 XT (RADV NAVI10) and the integrated GPU of a Ryzen 7 5700G (RADV RENOIR).

Persisting data

The default behaviour is to destroy the emulated device on container restart. To persist data, you need to mount a volume at /home/androidusr: docker run -v data:/home/androidusr budtmo/docker-android:emulator_14.0

WSL2 Hardware acceleration (Windows 11 only)

Credit goes to Guillaume - The Parallel Interface blog

Microsoft - Advanced settings configuration in WSL

  1. Add yourself to the kvm usergroup.

    sudo usermod -a -G kvm ${USER}
    
  2. Add necessary flags to /etc/wsl.conf to their respective sections.

    [boot]
    command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm'
    

    Then, using PowerShell, open a notepad on notepad $env:USERPROFILE\.wslconfig. Inside, put these other flags:

    [wsl2]
    nestedVirtualization=true
    
  3. Restart WSL2 via CMD prompt or Powershell

    wsl --shutdown
    

command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm' sets /dev/kvm to kvm usergroup rather than the default root usergroup on WSL2 startup.

nestedVirtualization flag is only available to Windows 11.

If this setup does not work, you may have an old WSL version. In that case, ignore \.wslconfig and put everything on /etc/wsl.conf, including the [wsl2] flag.

Talk to Your Emulator: AI-Agent & MCP

Control the emulator in plain language, e.g. "open the Settings app", powered by your own local LLM (Ollama or vLLM). Ready-to-run examples:

  1. Docker-Android MCP + AI-Agent
  2. Appium MCP + AI-Agent

Use-Cases

  1. Build Android project
  2. UI-Test with Appium
  3. Control Android emulator on host machine
  4. SMS Simulation
  5. Jenkins
  6. Deploying on cloud (Azure, AWS, GCP)

Custom-Configurations

This document contains information about configurations that can be used to enable some features, e.g. log-sharing, etc.

Genymotion

For you who do not have ressources to maintain the simulator or to buy machines or need different device profiles, you can give a try by using Genymotion SAAS. Docker-Android is integrated with Genymotion on different cloud services, e.g. Genymotion SAAS, AWS, GCP, Alibaba Cloud. Please follow this document for more detail.

Emulator Skins

The Emulator skins are taken from Android Studio IDE and Samsung Developer Website

USERS

docker-android-users

PRO VERSION

Due to high requests for help and to be able to actively maintain the projects, the creator has decided to create docker-android-pro. Docker-Android-Pro is a sponsor based project which mean that the docker image of pro-version can be pulled only by active sponsor.

The differences between normal version and pro version are:

Feature Normal Pro Comment
user-behavior-analytics Yes No -
AI-Agent No Yes Currently supported local-LLM server: Ollama, VLLM, It can also control emulator via REST-API
proxy No Yes Set up company proxy on Android emulator on fly
language No Yes Set up language on Android emulator on fly
Older Android version No Yes Support other newer Android version e.g. Android 9 and Android 10
Newer Android version No Yes Support other newer Android version e.g. Android 15, Android 16, Android 17, etc
root-privileged No Yes Able to run command with security privileged
Selenium 4.x integration No Yes Running Appium UI-Tests againt one (Selenium Hub) endpoint for Android- and iOS emulator(s) / device(s)
multiple Android-Simulators No Yes (soon) Save resources by having multiple Android-Simulators on one docker-container
Google Play Store No Yes (soon) -
Video Recording No Yes (soon) Helpful for debugging

List pro-version images:

Android API Usage Type Image with latest release version Image with specific release version
9.0 28 Development budtmo2/docker-android-pro:emulator_9.0 budtmo2/docker-android-pro:emulator_9.0_
10.0 29 Development budtmo2/docker-android-pro:emulator_10.0 budtmo2/docker-android-pro:emulator_10.0_
11.0 30 Development budtmo2/docker-android-pro:emulator_11.0 budtmo2/docker-android-pro:emulator_11.0_
12.0 32 Development budtmo2/docker-android-pro:emulator_12.0 budtmo2/docker-android-pro:emulator_12.0_
13.0 33 Development budtmo2/docker-android-pro:emulator_13.0 budtmo2/docker-android-pro:emulator_13.0_
14.0 34 Development budtmo2/docker-android-pro:emulator_14.0 budtmo2/docker-android-pro:emulator_14.0_
15.0 35 Development budtmo2/docker-android-pro:emulator_15.0 budtmo2/docker-android-pro:emulator_15.0_
16.0 36 Development budtmo2/docker-android-pro:emulator_16.0 budtmo2/docker-android-pro:emulator_16.0_
17.0 37 Development budtmo2/docker-android-pro:emulator_17.0 budtmo2/docker-android-pro:emulator_17.0_
9.0 28 Production-like budtmo2/docker-android-pro:emulator_playstore_9.0 budtmo2/docker-android-pro:emulator_playstore_9.0_
10.0 29 Production-like budtmo2/docker-android-pro:emulator_playstore_10.0 budtmo2/docker-android-pro:emulator_playstore_10.0_
11.0 30 Production-like budtmo2/docker-android-pro:emulator_playstore_11.0 budtmo2/docker-android-pro:emulator_playstore_11.0_
12.0 32 Production-like budtmo2/docker-android-pro:emulator_playstore_12.0 budtmo2/docker-android-pro:emulator_playstore_12.0_
13.0 33 Production-like budtmo2/docker-android-pro:emulator_playstore_13.0 budtmo2/docker-android-pro:emulator_playstore_13.0_
14.0 34 Production-like budtmo2/docker-android-pro:emulator_playstore_14.0 budtmo2/docker-android-pro:emulator_playstore_14.0_
15.0 35 Production-like budtmo2/docker-android-pro:emulator_playstore_15.0 budtmo2/docker-android-pro:emulator_playstore_15.0_
16.0 36 Production-like budtmo2/docker-android-pro:emulator_playstore_16.0 budtmo2/docker-android-pro:emulator_playstore_16.0_
17.0 37 Production-like budtmo2/docker-android-pro:emulator_playstore_17.0 budtmo2/docker-android-pro:emulator_playstore_17.0_
- - - budtmo2/docker-android-pro:agent budtmo2/docker-android-pro:agent_
- - - budtmo2/docker-android-pro:selenium budtmo2/docker-android-pro:selenium_

This document contains detail information about how to use docker-android-pro.

LICENSE

See License

docker-android (budtmo/docker-android)

正在搜索数据库…

这是什么东西?Docker-Android 是一个 Docker 镜像,在容器里提供完整的 Android 模拟器,专为 Android 应用开发和测试打造——原生应用、网页应用和混合应用都适用。
它是装在手机上的应用吗,还是说我运行的到底是什么?你运行的是一个 Docker 容器,它会模拟真实的设备配置和外观(Samsung Galaxy S6、Nexus 4 等多种机型),你可以在浏览器里通过 noVNC/VNC 查看它的屏幕,并用内置的网页界面查看日志。
怎么把它跑起来?先安装 Docker,然后拉取一个带版本标签的镜像并运行——例如 budtmo/docker-android:emulator14.0。从 Android 9.0 到 14.0 的每个版本都有对应镜像,另外还有 genymotion 变体和测试版的 mcp 变体。
除了 Docker,我的电脑还需要装别的东西吗?只需要一块开启了虚拟化的 CPU——模拟器运行离不开它。
如果容器重启,我模拟的设备会怎么样?默认情况下,重启时设备会被销毁。想保留数据的话,需要在 /home/androidusr 挂载一个卷。
它能在我的 Mac 或 Windows 笔记本上运行吗,还是只能在 Linux 上?只能在 Ubuntu 上运行:macOS 和 Windows 用户需要开一个运行 Ubuntu 的虚拟机。在 Windows 11 上,可以改用开启硬件加速的 WSL2——nestedVirtualization 这个选项仅限 Windows 11。
我能把它跑在云服务器或 CI 上,而不是自己的电脑上吗?可以——文档列出的使用场景包括部署到 Azure、AWS 和 GCP,在 Jenkins 下运行,以及从宿主机通过 adb connect 控制模拟器。
它会收集我的什么信息吗?免费镜像默认开启了用户行为分析;赞助者才能获取的专业版去掉了这些功能。
它能模拟哪些设备和 Android 版本?设备配置和外观覆盖多款手机和平板,比如 Samsung Galaxy S6 到 S10、Nexus 4/5/7/S/One 系列,以及 Pixel C。现成镜像覆盖 Android 9.0 到 14.0;Android 15 和 16 等版本只提供给专业版镜像。
我能对它跑自动化测试吗?可以,这正是它的主要用途之一:可以用 Appium、Espresso 这类框架跑单元测试和 UI 测试,从容器外部通过 adb connect 驱动,还有面向 CI 流水线的 Jenkins 集成。
专业版是怎么回事?专业版镜像采用赞助制:只有活跃的赞助者才能拉取。和免费版相比,它增加了运行时设置代理和语言、更新的 Android 版本、root 权限命令、无头模式以及 Selenium 4.x 集成——多模拟器、Google Play 商店和录屏功能则列为即将推出。
MCP 镜像是干什么用的?除了模拟器镜像,还有一个 budtmo/docker-android:mcp 镜像,以测试版形式提供 MCP 服务器,让 AI 智能体可以操作模拟出来的设备——该项目对自己的定位是带 MCP 服务器和 AI 智能体支持的 Docker 中的 Android。
作者
budtmo
大小
238.9 MB
星标
16.2K
时长
9年
提交 · 90 天