Reputation: 3223
How should I use the command vagrant destroy
?
In my VagrantFile I used vm.config.name = 'websvr'
and when I open Virtualbox I can see websvr on the list of Vm's.
But whenever I use vagrant destroy websvr
it returns:
The machine with the name 'websvr' was not found configured for this Vagrant environment.
How does vagrant destroy
work?
Upvotes: 21
Views: 28143
Reputation: 330
check the folder ./.vagrant/machines, and delete the ones you no longer need
Upvotes: 0
Reputation: 23
To destroy the vagrant you may try these simple steps:
vagrant destroy -f.
If these don't work out for you you may try it using bash.
Jump into the project folder where your actual code resides. Right-click and press git bash here. You will see a bash window popping up so just type in the same command in bash window: vagrant destroy -f
.
I hope these simple steps work out for you.
Upvotes: 1
Reputation: 711
To completely clean VM and start from fresh - the below worked for me - basically combination of what others have said already.
Check VM status with vagrant locally and destroy if exists - all done inside vagrant folder - MAKE SURE you are in the correct folder!
$ vagrant status
$ vagrant destroy
$ rm -rf .vagrant
Check VM status with vagrant globally and "destroy" if exists - can be done from anywhere
$ vagrant global-status
$ vagrant global-status --prune
Check VM status with VirtualBox's perspective and unregister VM
$ vboxmanage list vms
### note down long id, eg. c43266e6-e22b-437a-8cc1-541b7ed5c4b
$ vboxmanage unregistervm <long id> --delete
Go back into appropriate vagrant folder and start VM
$ vagrant up
Upvotes: 2
Reputation: 149
Lets try these action in command line
Check available installed boxes by calling
vagrant box list
Find box id
vagrant global-status --prune
Select by id name of your box for destroying.
vagrant destroy 1a2b3c4d
Thats all for you. Now you can destroy your vagrant box
vagrant destroy xxxxxxx
by this command.
Upvotes: 7
Reputation: 514
It seems the item does not exist, but it appears in the list because it is present in the cache. Use vagrant global-status --prune
to get rid of it.
See vagrant global-status documentation for more details.
Upvotes: 39
Reputation: 194
Try running vagrant status
first, which should list all of your VMs with their current status (running, not created, etc.)
The names of the VMs are displayed in the first column and are case sensitive.
For example, this is what the output of vagrant status
looks like on my machine:
base not created (virtualbox)
git not created (virtualbox)
go not created (virtualbox)
dev_workstation not created (virtualbox)
single_instance not created (virtualbox)
metrics not created (virtualbox)
Upvotes: 2