Vagrantfile

What is a .vagrantfile file?

HashiCorp Vagrant's VM config — Ruby DSL describing a virtual machine to provision and run for local development.

Use caution
Type Code
By HashiCorp / Mitchell Hashimoto
MIME text/x-ruby

Drop any file to identify it

No upload. No signup. No sending your file halfway across the internet.
We tell you what it is, right here in your browser.

What is it

Pre-Docker, the standard way to give every developer on a team an identical local environment was a virtual machine. Vagrant (HashiCorp's tool, not Vagrant Cosmonauts) made VMs scriptable: declare what you want in a Vagrantfile, run `vagrant up`, and you get a fully provisioned VM running on VirtualBox, VMware, Parallels, or libvirt. The Vagrantfile is the recipe.

The syntax is Ruby — `Vagrant.configure("2") do |config| ... end` wraps everything. Inside, you set `config.vm.box` (the base image: Ubuntu, CentOS, Alpine), `config.vm.network` (forwarded ports, private IPs), `config.vm.synced_folder` (host-to-VM file sharing), and provisioner blocks (shell scripts, Ansible playbooks, Chef recipes, Puppet manifests). The result is a reproducible dev VM that anyone on the team can `vagrant up` to identical state.

Docker has eaten most of Vagrant's use case for app-level dev environments — containers start in seconds where Vagrant's full VMs take minutes to boot. Vagrant remains useful when you need genuine OS-level isolation (kernel module testing, networking experiments, multi-OS reproducibility), and many infrastructure-as-code tutorials still use it. HashiCorp put Vagrant into maintenance mode in 2024 — bug fixes only, no new features.

Technical details
Full Name
Vagrantfile
MIME Type
text/x-ruby
Developer
HashiCorp / Mitchell Hashimoto
Magic Bytes
N/A
Safety
.vagrantfile requires caution. Vagrantfiles execute Ruby and run provisioning scripts. Review before `vagrant up` — they can download and run arbitrary code from the network.
What opens it
Any text editor
FREE All
VS Code
FREE All
FAQ
Should I use Vagrant or Docker for my dev environment?
For most app-level work, Docker. Containers start in seconds, share the host kernel, and consume far less RAM than a VM. Vagrant still wins when you need true OS isolation (kernel testing), specific OS reproducibility (Windows/BSD VMs), or system-level networking experiments. With HashiCorp shifting Vagrant to maintenance mode in 2024, new projects should default to Docker.
Why is the Vagrantfile written in Ruby?
HashiCorp's earliest tools were Ruby-based, and Mitchell Hashimoto's first version of Vagrant in 2010 was a Ruby gem — it stayed Ruby ever since. The DSL lets you do real logic (loops, conditionals, env-var-driven config) which JSON/HCL files would handle awkwardly.
Related formats