Tips & Tricks with Vagrant

I'll be updating this post with new tips and tricks about Vagrant as my personal list of useful commands and configurations.


Vagrant commands

Show all vagrant boxes

vagrant box list  

Remove a vagrant boxe

vagrant remove [BOX_NAME]  

 Start Vagrant without provisioning it

vagrant up --no-provision  

Vagrant global machines status not based on cache

vagrant global-status --prune  

This could be usefull if for some reason you are seeing a list of Vagrant machines that doesn't exist, to clean them up, it's just because Vagrant is pulling that list from the cache.

Documentation


Vagrant File

Skip checking for an updated Vagrant box

config.vm.box_check_update = false  

Sync folders

config.vm.synced_folder ".", "/vagrant"  

Always use Vagrant's default insecure key

config.ssh.insert_key = false  

Specify Vagrant version and Vagrant API version

Vagrant.require_version ">= 1.7.0"  

Set a default provider

By default Vagrant will use VirtualBox however we can specify whatever provider that we need like vmware_fusion or docker.

ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'  

Documentation