08 Apr 2013, 01:36
Generic-user-small

Jooin Kim (15 posts)

while setting multiple_vms, I get this when vagrant up.

ringing machine 'app' up with 'virtualbox' provider...    There are errors in the configuration of this machine. Please fix    the following errors and try again:
vm:
* Forwarded port '2222' (host port) is declared multiple times

2222 is declared multiple times? yes, like the book says.

Vagrant::Config.run do |config|   config.vm.define :app do |app_config|
app_config.vm.customize ["modifyvm", :id, "-- name", "app", "--memory", 512]
app_config.vm.box = "lucid64_with_ruby193"
app_config.vm.host_name = "app"
app_config.vm.forward_port 22, 2222, :auto => true
app_config.vm.forward_port 80, 4567
app_config.vm.network :hostonly, "33.33.13.37"   end   config.vm.define :db do |db_config|
db_config.vm.customize ["modifyvm", :id, "--name", "db", "--memory", 512]
db_config.vm.box = "lucid64_with_ruby193"
db_config.vm.host_name = "db"
db_config.vm.forward_port 22, 2222, :auto => true
db_config.vm.network :hostonly, "33.33.13.38"   end end

the code actually declared “ forward port 2222 “ twice…

08 Apr 2013, 01:45
Generic-user-small

Jooin Kim (15 posts)

I found another post with the same issue from Errata. here is the post.

51119: Hello,

running on Vagrant 1.1.2 MacOS 10.8.3, VB 4.2.10

According to the PDF:

“For forwarding the ssh port, we include the :auto option, which tells Vagrant that if the port isn’t available, it should search for another available port.”

Therefor writing:

app_config.vm.forward_port 22, 2222, :auto => true db_config.vm.forward_port 22, 2222, :auto => true

should result in:

[output]… [db] Fixed port collision for 22 => 2222. Now on port 2200. [db] Fixed port collision for 22 => 2222. Now on port 2201.

But on my machine I got following error:

vm:

  • Forwarded port ‘2222’ (host port) is declared multiple times

Cheers, David–David Jarosch

16 Sep 2013, 18:20
Generic-user-small

Pierre Sugar (8 posts)

I think the guest port comes first, the host port second

app_config.vm.forward_port 2222, 22, :auto => true

08 Oct 2013, 17:01
Generic-user-small

Justin Licata (1 post)

Pierre is correct..Thank you

  You must be logged in to comment