Suspending the VM

In order to start bootup time for the entire project, it would be useful to build the virtual machine and install all the apks that it needs, and suspend the machine to a file and store that file in the docker image.

Related reading:

cc @migueldar

The aim of this task is to change as much of the commands currently executed on the android docker entrypoint to the image, so i will install the certificate in the docker image as well

Well, i stumbled upon what i think is an unsolvable problem, remember about /dev/kvm?
Its the device that qemu uses for virtualization, and it cant be included into the docker image, so the android device cannot be launched in the dockerfile

Hm, what about a two-stage process? One image that will run the emulator the old way, then run a container with that image, suspend it to file, and make that file a part of another docker image? Unless there’s a neater way? Summoning :candle: @Jakski :candle: and :candle: @Wilmhit :candle: :innocent:

i never heard of smt like that, how could it be acomplished? @kuba-orlik

I believe you could run the VM as it is being ran now, in a container, then suspend it to a file. The file could be saved to a directory that’s a mounted volume and thus exist outside the container. It can then be used as a file that can be COPY-ied to a new, separate docker image

did a bit of research and i understood what you said, i didnt know doing something like that was possible, its super cool, will continue working

1 Like

The final solution was to use a snapshot of the android + docker commit.
As a result startup time has been improved from ~400secs to ~30secs :slight_smile:

https://hub.sealcode.org/D1364

@miguel Nice! Boots in fact in around 30s on my machine <3

Only two small cosmetic issues - I’ve left them ass comments in D1364.

I’m thinking that it would be nice to handle ctrl+c nicely, so the script cleans after itself once interrupted, and won’t leave docker containers hanging what do you think? :slight_smile:

Reviewed - and landed :wink: