Vagrant logo

After hearing about it a software engineering radio episode, and in several other podcasts/articles (FLOSS weekly maybe?), I decided to try using vagrant.

Vagrant describes itself as a way to "Create and configure lightweight, reproducible, and portable development environments".

From my current (limited) understanding of it, it describes a development environment (for most use cases, this is a virtual machine that we will use to test our project on). This description is in fact a Vagrantfile that is created when you initialise your project with the vagrant init command.

In the Vagrantfile you can specify what "box" your virtual machine will be based on, port forwarding rules, if the virtual machine should run in headless mode or if you need a GUI, etc. This file is typically checked-in with your code, so that a new developer can just type vagrant up and have a fully working test environment.

Vagrant refers to base virtual machines as boxes. The simplest way is to just use a pre-made one from their site, but you can also import a box from a VirtualBox virtual machine and use that.

You can ssh into the virtual machine with a simple "vagrant ssh" command, and the folder where the Vagrantfile is located is shared with the virtual machine (you can access it in /vagrant). All very developer friendly (I was doing all this manually until now!).

Vagrant is typically used for web development, but given that it supports several types of providers (what actually runs the VM), I can see it being used for other use cases as well.

The default provider is VirtualBox, but you can install more. The docker and kvm/qemu providers caught my eye, and I will most likely take them for a spin sometime soon.


Overall, I'm very glad I gave vagrant a try.


Rui Pires

Working as a professional full time remote developer from the Azores since 2011.

Read More