Vagrant cheat sheet
A quick overview of the most useful vagrant commands.
Hint: “ve” means vagrant environment – the virtual machine(s) you run.
| Command | Remark |
|---|---|
| vagrant up | start ve |
| vagrant halt | stop ve |
| vagrant reload | reload Vagrantfile, restart ve |
| vagrant destroy | destroy ve |
| vagrant status | show status of ve(s) |
| vagrant box list | show local baseboxes |
| vagrant box add http://local.example.com/vagrant/box.json --box-version 2019.05.04 | explicitly install a box from the given location and version |
| vagrant box update | update all baseboxes currently installed |
| vagrant box update --box prefix/boxname | update just the given basebox |
| vagrant box prune | remove outdated baseboxes |
| vagrant box prune --name prefix/boxname | remove just the given outdated baseboxes |
| vagrant box remove prefix/boxname | remove all cached instances of the given basebox |
| vagrant box remove prefix/boxname --box-version 2019.05.04 | remove just the given basebox and version |
| vagrant up --provision ve | provision the ve with all provisioners (again) |
| vagrant up --provision-with ansible ve | provision the ve with ansible (again) |
| vagrant reload --provision ve | reload Vagrantfile, restart the ve and provision it again |
| vagrant provision ve | provision the running ve without restart |
| vagrant provision --provision-with-ansible ve | provision the running ve with ansible and without restart |
How to return to a previous version of a vagrant basebox
- remove any vagrant environment based on the basebox you want to remove:
vagrant destroy - remove the basebox:
vagrant box remove prefix/basebox --box-version xyz - if you already pruned the previous basebox you have to download it again:
vagrant box add http://local.example.com/vagrant/basebox.json --box-version xyz - check if it is there:
vagrant box list - create a new vagrant environment:
vagrant up