我将 Vagrant 用于一盒配置文件。现在我想对另一个盒子 (b2) 使用 Vagrant,但它说 bioiq 的实例正在消耗转发的端口 2222(确实如此)。
现在,如果我使用以下配置 b2,Vagrant 仍然尝试使用 2222。
Vagrant.configure("2") do |config|
config.vm.box = 'precise32'
config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
config.vm.network :forwarded_port, guest: 22, host: 2323
# Neither of these fix my problem
# config.vm.network :private_network, type: :dhcp
# config.vm.network :private_network, ip: "10.0.0.200"
end
我尝试了其他 SO 问题的各种方法来设置:转发端口 (see here https://stackoverflow.com/questions/10953070/how-to-debug-vagrant-cannot-forward-the-specified-ports-on-this-vm-message and here https://stackoverflow.com/questions/20530203/portforwarding-for-multiple-vms-using-same-port-forwarding-rules)。我也尝试过这个Google 群组帖子 https://groups.google.com/forum/#!topic/vagrant-up/HwqFegoCXOc,无济于事。我不断收到此消息。
Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening
on these ports. The forwarded port to 2222 is already in use
on the host machine.
To fix this, modify your current projects Vagrantfile to use another
port. Example, where '1234' would be replaced by a unique host port:
config.vm.network :forwarded_port, guest: 22, host: 1234
Sometimes, Vagrant will attempt to auto-correct this for you. In this
case, Vagrant was unable to. This is usually because the guest machine
is in a state which doesn't allow modifying port forwarding.
我不知道为什么 Vagrant 总是无视我的指令。发布的配置不起作用。有人克服这个吗?