Hello,
I've been working on a project to run VMs in Docker containers. These VMs are supposed to boot quickly by restoring from snapshots, thus providing a ready to use VM in 5-15 seconds. This is done via 2 snapshots, one snapshot was taken when using KVM and one snapshot was taken when running in full emulation mode.
The container runs this system on startup and the VM can then be used in a fashion similar to that of vagrant VMs. In fact, the VM is based on a VM built by packer and the vagrant SSH keys are also used.
Startup process of the VM in the Docker container run with -privileged:
1. check if the KVM module is loaded
2. attempt to set up the KVM device node
3. attempt to start the VM by restoring the snapshot taken with KVM enabled
4. if 3 failed, try to start the VM by restoring the snapshot taken with KVM disabled
5. run things on the VM: ssh -p 2222
vag...@127.0.0.1The purpose of these VMs is to allow some more advanced testing and to perform testing which may break something on the host system.
The Docker tests finish running just like on the host system when using KVM acceleration. However, they're very slow and they fail to run at all when running on the fully emulated QEMU VM.
Would there be interest in fixing the Docker testing to make it work under fully emulated QEMU VMs?
Would there be any value in using these VMs for some kind of tasks (testing, testing packages, testing kernel bugs)?
Do you think it'd be OK to use this kind of VMs for building the vbox/vmware/qemu/xen/ec2 VM images to be downloaded by users?
The image is available as backjlack/qemu on the official registry and it can be used like this:
$ docker run -i -t -privileged backjlack/qemu
# you should get to a shell prompt in 5-15 seconds
# exit will close the SSH session and close the container & the VM
Observation: mknod will fail to create the /dev/kvm device node if KVM isn't available. Some errors will be printed to the screen, but the fully emulated VM should work.
I will provide the Dockerfile and the files used to create that Docker image soon.