2015-11-24 21:33:05 +00:00
|
|
|
---
|
2016-01-19 18:08:53 +00:00
|
|
|
layout: "docs"
|
2015-11-24 21:33:05 +00:00
|
|
|
page_title: "vagrant port - Command-Line Interface"
|
|
|
|
sidebar_current: "cli-port"
|
2016-01-19 18:08:53 +00:00
|
|
|
description: |-
|
|
|
|
The "vagrant port" command is used to display the full list of guest ports
|
|
|
|
mapped to the host machine ports.
|
2015-11-24 21:33:05 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Port
|
|
|
|
|
2016-04-12 11:45:10 +00:00
|
|
|
**Command: `vagrant port [name|id]`**
|
2015-11-24 21:33:05 +00:00
|
|
|
|
|
|
|
The port command displays the full list of guest ports mapped to the host
|
|
|
|
machine ports:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ vagrant port
|
|
|
|
22 (guest) => 2222 (host)
|
|
|
|
80 (guest) => 8080 (host)
|
|
|
|
```
|
|
|
|
|
|
|
|
In a multi-machine Vagrantfile, the name of the machine must be specified:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ vagrant port my-machine
|
|
|
|
```
|
|
|
|
|
|
|
|
## Options
|
|
|
|
|
|
|
|
* `--guest PORT` - This displays just the host port that corresponds to the
|
|
|
|
given guest port. If the guest is not forwarding that port, an error is
|
|
|
|
returned. This is useful for quick scripting, for example:
|
|
|
|
|
|
|
|
$ ssh -p $(vagrant port --guest 22)
|
|
|
|
|
|
|
|
* `--machine-readable` - This tells Vagrant to display machine-readable output
|
|
|
|
instead of the human-friendly output. More information is available in the
|
2016-01-19 18:08:53 +00:00
|
|
|
[machine-readable output](/docs/cli/machine-readable.html) documentation.
|