Docker container that runs Android cuttlefish emulators for x86_64, arm64, riscv64 guests
I simply wanted to run RISC-V AOSP via cuttlefish on my laptop, and the journey wasn't smooth.
- The info is scarce, broken and conflicting
- My host machine ends up seriously "polluted" and cluttered by packages, virtual devices and run-time artifacts
- The existing container-based solution by Google is an overkill and not friendly at all
Simple container that runs 1 cuttlefish instance inside on my x86_64 linux host. Incidentally it can now run following guests:
- x86 guest via crosvm
- x86 guest via qemu
- arm64 guest via qemu
- riscv64 guest via qemu
3 steps to use the container:
- build the docker image with "docker build ..."(once)
- create or update the cvd instance with "cf-init.sh ..." (infrequently, as needed)
- populate/update instance with aosp img zip and/or cvd host package
- run the cvd instance with "cf-run.sh" (frequently)
- connect to the instance via adb, vnc or webrtc
Below is a sample execution sequence.
docker build . -t cf-host
./cf-init.sh -P aosp_cf_x86_64_only_phone-img-14421689.zip -H cvd-host_package.tar.gz
# run with qemu
./cf-run.sh
gvncviewer localhost
# or run with crosvm, much faster
./cf-run.sh -- -e CF_VM_MANAGER=crosvm -e CF_START_WEBRTC=true
firefox https://localhost:8443
# connect via adb
adb connect localhost:6520
You can find product img zip file and cvd host package from Google aosp build artifacts site.
Or build them from your own aosp tree,
source build/envsetup.sh
lunch aosp_cf_x86_64_only_phone-aosp_current-userdebug
m dist
# those two packages can be found under $(ANDROID_ROOT)/out/dist/
Additional notes:
- run "cf-init.sh -h" and "cf-run.sh -h" for more info
- to create multiple containers/instances, create multiple directories. For example, "mkdir riscv; cd riscv; ../cf-init.sh ....; ../cf-run.sh".
- However, you can only run 1 of them at any time due to port conflict.
- ADB, VNC ports are visiable to host LAN. So you can run it on a headless server.
- GPU acceleration does not work yet
