blob: 86afbecc3711cdb85787c0fabfb59a6b278b665e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<h1 id="port"> Port </h1> <p><strong>Command: <code>vagrant port [name|id]</code></strong></p> <p>The port command displays the full list of guest ports mapped to the host machine ports:</p> <div class="highlight"><pre class="highlight plaintext">$ vagrant port
22 (guest) => 2222 (host)
80 (guest) => 8080 (host)
</pre></div>
<p>In a multi-machine Vagrantfile, the name of the machine must be specified:</p> <div class="highlight"><pre class="highlight plaintext">$ vagrant port my-machine
</pre></div>
<h2 id="options"> Options </h2> <ul> <li>
<p><a href="#guest-port"><code>--guest PORT</code></a> - 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:</p> <div class="highlight"><pre class="highlight plaintext">$ ssh -p $(vagrant port --guest 22)
</pre></div>
</li> <li>
<p><a href="#machine-readable"><code>--machine-readable</code></a> - This tells Vagrant to display machine-readable output instead of the human-friendly output. More information is available in the <a href="machine-readable">machine-readable output</a> documentation.</p> </li> </ul><div class="_attribution">
<p class="_attribution-p">
© 2010–2018 Mitchell Hashimoto<br>Licensed under the MPL 2.0 License.<br>
<a href="https://www.vagrantup.com/docs/cli/port.html" class="_attribution-link">https://www.vagrantup.com/docs/cli/port.html</a>
</p>
</div>
|