【发布时间】:2014-07-30 10:34:13
【问题描述】:
我将 Vagrant 用于一个盒子配置文件。现在我想将 Vagrant 用于另一个盒子(b2),但它说 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 问题中的各种方法来设置 :forwarded_port(请参阅 here 和 here)。我也试过这个Google Group post,但无济于事。我不断收到此消息。
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 总是无视我的指令。发布的配置不起作用。有没有人克服这个?
【问题讨论】:
标签: networking virtual-machine vagrant