I build my app locally on Linux in a Vagrant machine (using KVM as hypervisor), so when I am happy with it, I use Vagrant to deploy to production.
However each time I make a change, Vagrant have to build it all from stretch, and this takes forever. When using Docker, it only builds the layers that changed, which is what I would like to have with Vagrant as well.
Question
Does there exist caching in Vagrant similar to how Docker only rebuilds the layers that changed?
Vagrant is not using the container approach but the virtual machine one. Vagrant builds whole machines, so working with layers would be impossible to implement.
Couldn’t Vagrant use the hypervisors snaphot feature to get the exact caching layers that Docker have?
I don’t think you understand the layer principle. A snapshot is like a freezed state of the machine at the time of creation. A layer is a layer with additional stuff put on top of the existing one.
For KVM/Xen/VMware at least a snapshot is a file system snapshot, so Vagrant could add a snapshot command that the user can add strategic places in the Vagrantfile, and the user/developer could revert to this snapshot/layer rather than starting from scratch like now.