Why is Vagrant better than a basic VM?

I started playing around with Vagrant over the weekend, and I just didn’t get it.

Why would someone want to use this over just a standard VM image? How is this better? What problems does it solve?

I keep a few VM images with different configurations that I use for templates and what not. I just copy them over and boot them in VirtualBox and everything runs fine, ssh, folder sharing, etc… Is Vagrant somehow better than this?

It’s easier to make sure every developer is running the same environment.

Copy-pasting a VBox VM would do the same, but it’s much less convenient to copy 10’s of GB to each developer, and if the VM needs to be updated, then you’d need to re-copy the VM to each developer again. With Vagrant, on the other hand, you can keep the vagrant file checked in to the source tree, so every developer will always have the latest environment.

Ah ok, I wasn’t thinking outside my bubble. Thanks.

For my little home projects where I mostly work solo it would probably just add unnecessary complexity.

Not so much – the value is really in the fact you can much more easily store the recipe to create the VM so you don’t need to store gads of VMs and such. Or instructions on how to build the next one.

The other advantage is experimentation – you can try things that might not work in the vagrant file and get back to status quo ante bellum relatively quickly.

+1 to what wwb_99 and Jeff have stated.

I’ve started tying Vagrant into my local development cycle and I’ve been thrilled with it. I’ve been able to destroy the gigs of VMs I previously used and the two physical servers I had lying around and simply use Vagrant. Sure it can take a few minutes for it to startup on its initial run, but once I have it running and I know I’ll be in it for a few days/weeks, it is a god send. Then when I’m done, I tell it to destroy itself and my hard drive space is restored.

I’ve started to get into the habit of putting a few Vagrant files inside my source, so I can test against multiple operating systems/software configurations quickly. I don’t necessarily boot them at the same time, but I at least have them to verify my work runs seamlessly on each one.