无法清理 Vagrant Box "Remove" 或 "Destroy"

4

我正在使用 Windows 10 上的 Vagrant 1.8.1。在尝试删除或销毁一个 box 时,我得到了以下矛盾的结果:

baria@DESKTOP-057K4L5 /c/repos/hub/vtc/linphone-windows-dependencies
$ vagrant box list
hashicorp/precise64  (virtualbox, 1.1.0)
windows_2012_r2_core (virtualbox, 0)

baria@DESKTOP-057K4L5 /c/repos/hub/vtc/linphone-windows-dependencies
$ vagrant box remove windows_2012_r2_core
Box 'windows_2012_r2_core' (v0) with provider 'virtualbox' appears
to still be in use by at least one Vagrant environment. Removing
the box could corrupt the environment. We recommend destroying
these environments first:

vagrant-windows-2012-r2-core (ID: 00d3488f41fa40998bfe16ada2ebfd31)

Are you sure you want to remove this box? [y/N] N

baria@DESKTOP-057K4L5 /c/repos/hub/vtc/linphone-windows-dependencies
$ vagrant destroy windows_2012_r2_core
The machine with the name 'windows_2012_r2_core' was not found configured for
this Vagrant environment.

我已经搜索了“Vagrant环境”的解释,但没有找到任何结果。因此,我不知道如何“销毁环境”。
即便如此,我期望destroy命令能够确认我的windows_2012_r2_core虚拟机的存在,因为listremove命令已经确认过它的存在。
这里发生了什么?如何干净地摆脱这个虚拟机,而不会出现警告或错误?
2个回答

6

您可以直接销毁引用的虚拟机,vagrant destroy 00d3488f41fa40998bfe16ada2ebfd31将销毁使用此框的虚拟机,然后您就可以删除该框。

正如@Brandon Davis所提到的,您可以运行vagrant global-status以查看已创建的vagrant虚拟机列表(从vagrant 1.6+开始),并查看哪个虚拟机是00d3488f41fa40998bfe16ada2ebfd31。


2

您需要从列表中删除无效的条目。

vagrant global-status --prune

有关该命令的更多信息,请参见此处


不幸的是,那并没有改变我所看到的行为。 - Brent Arias
vagrant global-status 显示什么?看起来有一个正在运行此 box 的环境。 - Brandon Davis

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接