docker-android
虚拟化环境准备
VMware 中的虚拟机开启虚拟化
开启 VMware 中的虚拟机的虚拟化,其实就是开启VMware 中的虚拟机的 IntelVT-x/EPT或AMD-V/RVI(V)。
进入虚拟机的设置界面,选择"硬件",然后选择"处理器",然后勾选"虚拟化 IntelVT-x/EPT或AMD-V/RVI(V)",此时我们就开启了 VMware 中虚拟机的虚拟化
此时,如果没有经过本文档后续的系统配置 ,那么你大概率会出现类似 此平台不支持虚拟化的IntelVT-x/EPT 的报错
检查自己的电脑是否开启了虚拟化
<Ctrl-Shift-Esc>,点击"性能->CPU",查看"虚拟化"是否显示"已启用"。
如果没有开启,则需要进入主板的 BIOS 中开启虚拟化功能,由于不同的主板进入 BIOS 开启虚拟化的方式略有不同,所以这里不讲述如何操作
关闭 Windows 自带的虚拟机功能
<win-r,control>,点击<启用或关闭Windows功能>,取消勾选“Hyper-V”、“Windows虚拟机监控程序平台”、“虚拟机平台”,然后重启电脑。
禁用 Windows 自带的虚拟机的相关服务
<win-r,services.msc>,禁用 Windows 自带的虚拟机 Hyper-V 的相关服务:
- HV 主机服务
- Hyper-V 卷影复制请求程序
- Hyper-V 主机计算服务
停止 hypervisorlaunchtype(Windows Hyper-V 启动加载器)
以管理员的身份打开命令行窗口,运行如下命令,关闭停止 Windows Hyper-V 启动加载器
| |
重启 VMware 虚拟机
接下来,在开启虚拟机的虚拟化 IntelVT-x/EPT或AMD-V/RVI(V) 的情况下,再次启动虚拟机即可正常启动
Quick Start
- 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.
Your machine should support virtualization. To check if the virtualization is enabled is:
1 2sudo apt install cpu-checker kvm-okRun Docker-Android container
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32# 容器如果不存在则pull,并且运行,如果已存在该容器则跳过,并且没有运行的容器也不会运行 sudo 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_11.0 # 或,映射ADB端口,开放5554/5555端口 sudo docker run \ -d \ -p 6080:6080 \ -p 5554:5554 -p 5555:5555 \ -e EMULATOR_DEVICE="Samsung Galaxy S10" \ -e WEB_VNC=true \ --device /dev/kvm \ --name android-container \ budtmo/docker-android:emulator_11.0 # 或 sudo docker run \ -d \ -p 6080:6080 \ -p 5554:5554 -p 5555:5555 \ -e EMULATOR_DEVICE="Samsung Galaxy S10" \ -e WEB_VNC=true \ --device /dev/kvm \ --name android-container \ budtmo/docker-android:emulator_11.0 # 运行容器 sudo docker run \ -d \ -p 6080:6080 \ -p 5554:5554 -p 5555:5555 \ -e EMULATOR_DEVICE="Samsung Galaxy S10" \ -e WEB_VNC=true \ --device /dev/kvm \ -it budtmo/docker-android:emulator_11.0- Open http://localhost:6080 to see inside running container.
To check the status of the emulator
1 2 3 4# device_status不会立马出现,需要等待一段时间才会被创建 sudo docker exec -it android-container cat device_status # 或,进入容器 sudo docker run -it budtmo/docker-android:emulator_11.0 bash
完整操作顺序(推荐直接复制执行)
| |
启动成功后,用下面命令看模拟器启动日志,确认安卓开机
| |
scrcpy远程控制示例
| |