Now that we’ve learned how to manage the power state of our development environment we can discuss how we delete and reset our development environments using Vagrant commands.
Destroying Our Vagrant VM
There are some situations where we need to delete our development environment. This may be because we need to reset the VMs due to upgrades, we may have deleted something we didn’t want to, or we might just need to be done with our project.
Vagrant destroy causes Vagrant to delete all the VMs from our system that are associated with our Vagrantfile.
our-awesome-project % vagrant destroy default: Are you sure you want to destroy the 'default' VM? [y/N] Y ==> default: Forcing shutdown of VM... ==> default: Destroying VM and associated drives...
If we look in VirtualBox at this point we can see that our VM is no longer listed. This is because we’ve completely removed it from the system.
In our next post, we’ll discuss Vagrant’s networking options.
Scott is the Director of Technology at WeCare Connect where he strives to provide solutions for his customers needs. He's the father of two and can be found most weekends working on projects around the house with his loving partner.