» Port

Command: vagrant port [name|id]

The port command displays the full list of guest ports mapped to the hostmachine ports:

  1. $ vagrant port
  2. 22 (guest) => 2222 (host)
  3. 80 (guest) => 8080 (host)

In a multi-machine Vagrantfile, the name of the machine must be specified:

  1. $ vagrant port my-machine

» Options

  • —guest PORT - This displays just the host port that corresponds to thegiven guest port. If the guest is not forwarding that port, an error isreturned. This is useful for quick scripting, for example:
  1. $ ssh -p $(vagrant port --guest 22)