BBVA / kvm

Simple Docker KVM container
Apache License 2.0
207 stars 50 forks source link

Do not modify the qcow-image on runtime? #20

Open pwFoo opened 8 years ago

pwFoo commented 8 years ago

At the moment the changes written to the qcow image directly I think? Because delete and recreate the container keeps all the changes.

A option to keep the qcow (base) image unchanged would be great, but save the changes to be container restart save?

methadata commented 8 years ago

You can achieve what you need if you build a new container based on this one and add the image you want to run to the container.

Take a look at the dockerfile in VSC directory of this project. The image is not included in the repo because it's proprietary software from Nokia, but you can see how easy is to do it.

We use this method to launch our own services. Once you build a docker image with the VM image on it, you have the same VM each time you run it.

Anyway, I will explore this as an optional flag, if qemu has that option.

pwFoo commented 8 years ago

As optional flag would be fine.

The method you explained is the same way it is done with RancherVM? Would be fine too :)

pwFoo commented 7 years ago

Maybe create a image with image embedded is the best way (docker image, version, tags, ...), but it should be possible with qemu snapshots? https://wiki.qemu.org/index.php/Documentation/CreateSnapshot#Modifying_the_backing_file

segator commented 6 years ago

I did my own version of KVM in docker what I do when the container start is create a linked qcow image from the base imatge, the newly created qcow2 file is exposed in the docker volume, so you can persist changes outside the container and can be persisted. Also created a smb service on the container and exposed as volume so the guest OS can have like a container volume system(but the performance is degraded) Only point pending to fix is how to expose environment variables from the container to the kvm guest