kaeawc/auto-mobileThis project includes Docker support for running AutoMobile in a containerized environment with all required Android development tools.
To use this Docker image with MCP clients, see the MCP Client Configuration Guide for complete setup instructions.
Quick example for Claude Desktop:
json{ "mcpServers": { "auto-mobile": { "command": "docker", "args": ["run", "-i", "--rm", "--init", "--privileged", "--network", "host", "auto-mobile:latest"] } } }
bash# Build the image docker-compose build # Run in production mode docker-compose up auto-mobile # Run in development mode (with auto-reload) docker-compose up auto-mobile-dev
Published images are available on Docker Hub: kaeawc/auto-mobile
bash# Pull latest version docker pull kaeawc/auto-mobile:latest # Pull specific version docker pull kaeawc/auto-mobile:0.0.7 # Pull major.minor version (recommended for stability) docker pull kaeawc/auto-mobile:0.0 # Pull specific commit docker pull kaeawc/auto-mobile:main-abc1234
For maintainers: See Docker Hub Setup Guide for publishing credentials and workflow configuration.
The Docker image contains:
To include Android emulator/system images, build with:
bashdocker build --platform=linux/amd64 --build-arg ANDROID_INSTALL_EMULATOR=true -t auto-mobile:latest .
bash# Interactive shell docker-compose exec auto-mobile bash # Run tests docker-compose exec auto-mobile npm test # Run linter docker-compose exec auto-mobile npm run lint # Check connected devices docker-compose exec auto-mobile adb devices # Build Android components docker-compose exec auto-mobile bash -c "cd android && ./gradlew build"
For complete documentation, see docs/docker.md
--platform=linux/amd64 on Apple Silicon.When the image is built without the emulator (ANDROID_INSTALL_EMULATOR=false), use the host emulator setup for
your OS so the container can access your installed AVDs and running emulators.
Linux (host SDK + emulator inside container):
bashdocker run --platform=linux/amd64 -it --rm --name auto-mobile \ --network host \ -e ANDROID_HOME=/opt/android-sdk \ -e ANDROID_SDK_ROOT=/opt/android-sdk \ -e AUTOMOBILE_EMULATOR_HEADLESS=true \ -v "$HOME/Android/Sdk:/opt/android-sdk" \ -v "$HOME/.android:/home/automobile/.android" \ -v "$HOME/.auto-mobile:/home/automobile/.auto-mobile" \ auto-mobile:latest
macOS (host emulator, container auto-connects via ADB):
bashdocker run --platform=linux/amd64 -it --rm --name auto-mobile \ -e ANDROID_HOME=/opt/android-sdk \ -e ANDROID_SDK_ROOT=/opt/android-sdk \ -e AUTOMOBILE_EMULATOR_EXTERNAL=true \ -v "$HOME/.android:/home/automobile/.android" \ -v "$HOME/.auto-mobile:/home/automobile/.auto-mobile" \ auto-mobile:latest
With AUTOMOBILE_EMULATOR_EXTERNAL=true, the container automatically connects to host emulators running on
host.docker.internal:5555-5585. The auto-connect service scans for emulators every 10 seconds and reconnects
when emulators restart. No manual adb connect required.
Do not mount the macOS SDK into /opt/android-sdk (macOS binaries will not run in the Linux container).
Environment variables for auto-connect:
| Variable | Default | Description |
|---|---|---|
AUTOMOBILE_EMULATOR_EXTERNAL | false | Enable external/host emulator mode with auto-connect |
AUTOMOBILE_HOST_GATEWAY | host.docker.internal | Hostname to connect to host emulators |
AUTOMOBILE_EMULATOR_SCAN_INTERVAL_MS | *** | How often to scan for new emulators (ms) |
AUTOMOBILE_EMULATOR_PORT_START | 5555 | First emulator ADB port to scan |
AUTOMOBILE_EMULATOR_PORT_END | 5585 | Last emulator ADB port to scan |
For full ADB command support (including adb emu kill and other console commands), you can connect the container to the host's ADB server instead of individual device ports:
bash# On the host, ensure ADB server is running adb start-server # Run container with ADB server tunnel docker run --platform=linux/amd64 -it --rm --name auto-mobile \ -e ANDROID_HOME=/opt/android-sdk \ -e ANDROID_SDK_ROOT=/opt/android-sdk \ -e AUTOMOBILE_EMULATOR_EXTERNAL=true \ -e AUTOMOBILE_ADB_SERVER_HOST=host.docker.internal \ -e AUTOMOBILE_ADB_SERVER_PORT=5037 \ -v "$HOME/.android:/home/automobile/.android" \ -v "$HOME/.auto-mobile:/home/automobile/.auto-mobile" \ auto-mobile:latest
Benefits of ADB Server Tunnel:
emu kill, etc.)| Variable | Default | Description |
|---|---|---|
AUTOMOBILE_ADB_SERVER_HOST | (none) | Host's ADB server address (enables tunnel mode when set) |
AUTOMOBILE_ADB_SERVER_PORT | 5037 | Host's ADB server port |
For starting/stopping emulators and running SDK commands from within the container, run the host control daemon on your macOS host:
bash# Start the host control daemon (runs on port ***) node scripts/docker/host-control-daemon.js # Or with custom settings node scripts/docker/host-control-daemon.js --port *** --host 0.0.0.0
The daemon provides a JSON-RPC interface for:
list-avds - List available AVDsstart-emulator - Start an emulator by AVD namestop-emulator - Stop an emulatorlist-running - List running emulatorsavdmanager - Run avdmanager commandssdkmanager - Run sdkmanager commandsRun the container with host control:
bashdocker run --platform=linux/amd64 -it --rm --name auto-mobile \ -e AUTOMOBILE_EMULATOR_EXTERNAL=true \ -e AUTOMOBILE_HOST_CONTROL_HOST=host.docker.internal \ -e AUTOMOBILE_HOST_CONTROL_PORT=*** \ -v "$HOME/.android:/home/automobile/.android" \ -v "$HOME/.auto-mobile:/home/automobile/.auto-mobile" \ auto-mobile:latest
| Variable | Default | Description |
|---|---|---|
AUTOMOBILE_HOST_CONTROL_HOST | host.docker.internal | Host control daemon address |
AUTOMOBILE_HOST_CONTROL_PORT | *** | Host control daemon port |
AUTOMOBILE_HOST_CONTROL_ENABLED | true | Set to false to disable host control integration |
adb devicesadb kill-server && adb start-server--privileged flagbash# Clean and rebuild docker-compose down -v docker-compose build --no-cache docker-compose up
bash# Lint Dockerfile ./scripts/docker/validate_dockerfile.sh # Run container structure tests ./scripts/docker/test_container.sh # Test host emulator access from the slim image (auto-starts host emulator if needed) ./scripts/docker/test_host_emulator_mcp.sh
bash# Build image docker build --platform=linux/amd64 -t auto-mobile:latest . # Test stdio communication echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | docker run --platform=linux/amd64 -i --rm --init auto-mobile:latest
For more help, see the full Docker documentation and MCP configuration guide.
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
MacOS OrbStack 容器配置
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务