Failed Vagrant up rerun for VirtualBox 给出错误
Failed Vagrant up rerun for VirtualBox gives error
最近,我尝试使用 VirtualBox 作为 VM 提供程序设置一个 Vagrant box。
在我的第一次尝试中,Vagrant 正确地创建了虚拟框,但由于一些厨师错误而失败了。
我解决了 chef 指出的错误并再次运行 vagrant up 命令,但是这次我得到以下错误:
Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening on
these ports.
失败时,vagrant 没有清理它与 VBox 关联的端口。我什至尝试从它创建的 Virtual Boxes 目录中删除 .vagrant 目录和机器。仍然出现相同的错误。我只能通过更改 vagrant 文件中的端口转发来 运行 它。
如果有任何方法可以在失败时强制设置 vagrant auto correct/clean,请告诉我;因为我不想在失败时更改 vagrantfile,这可能由于多种原因而发生。
提前致谢。
有一个 auto_correct
您可以使用的选项
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 80, host: 8080,
auto_correct: true
end
来自https://www.vagrantup.com/docs/networking/forwarded_ports.html
It is common when running multiple Vagrant machines to unknowingly
create forwarded port definitions that collide with each other (two
separate Vagrant projects forwarded to port 8080, for example).
Vagrant includes built-in mechanism to detect this and correct it,
automatically.
Port collision detection is always done. Vagrant will not allow you to
define a forwarded port where the port on the host appears to be
accepting traffic or connections.
Port collision auto-correction must be manually enabled for each
forwarded port, since it is often surprising when it occurs and can
lead the Vagrant user to think that the port was not properly
forwarded. Enabling auto correct is easy:
The final :auto_correct parameter set to true tells Vagrant to auto
correct any collisions. During a vagrant up or vagrant reload, Vagrant
will output information about any collisions detections and auto
corrections made, so you can take notice and act accordingly.
最近,我尝试使用 VirtualBox 作为 VM 提供程序设置一个 Vagrant box。 在我的第一次尝试中,Vagrant 正确地创建了虚拟框,但由于一些厨师错误而失败了。
我解决了 chef 指出的错误并再次运行 vagrant up 命令,但是这次我得到以下错误:
Vagrant cannot forward the specified ports on this VM, since they would collide with some other application that is already listening on these ports.
失败时,vagrant 没有清理它与 VBox 关联的端口。我什至尝试从它创建的 Virtual Boxes 目录中删除 .vagrant 目录和机器。仍然出现相同的错误。我只能通过更改 vagrant 文件中的端口转发来 运行 它。
如果有任何方法可以在失败时强制设置 vagrant auto correct/clean,请告诉我;因为我不想在失败时更改 vagrantfile,这可能由于多种原因而发生。
提前致谢。
有一个 auto_correct
您可以使用的选项
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 80, host: 8080,
auto_correct: true
end
来自https://www.vagrantup.com/docs/networking/forwarded_ports.html
It is common when running multiple Vagrant machines to unknowingly create forwarded port definitions that collide with each other (two separate Vagrant projects forwarded to port 8080, for example). Vagrant includes built-in mechanism to detect this and correct it, automatically.
Port collision detection is always done. Vagrant will not allow you to define a forwarded port where the port on the host appears to be accepting traffic or connections.
Port collision auto-correction must be manually enabled for each forwarded port, since it is often surprising when it occurs and can lead the Vagrant user to think that the port was not properly forwarded. Enabling auto correct is easy:
The final :auto_correct parameter set to true tells Vagrant to auto correct any collisions. During a vagrant up or vagrant reload, Vagrant will output information about any collisions detections and auto corrections made, so you can take notice and act accordingly.