summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fport%2Findex.html
blob: 122a0db50797a24d5a7011a5af03b45653176144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<h1>docker port</h1>  <p><br></p> <p>List port mappings or a specific mapping for the container</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker port CONTAINER [PRIVATE_PORT[/PROTO]]
</pre></div> <p>For example uses of this command, refer to the <a href="#examples">examples section</a> below.</p>  <h2 id="examples">Examples</h2> <h3 id="show-all-mapped-ports">Show all mapped ports</h3> <p>You can find out all the ports mapped by not specifying a <code class="language-plaintext highlighter-rouge">PRIVATE_PORT</code>, or just a specific mapping:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                            NAMES
b650456536c7        busybox:latest      top                 54 minutes ago      Up 54 minutes       0.0.0.0:1234-&gt;9876/tcp, 0.0.0.0:4321-&gt;7890/tcp   test

$ docker port test

7890/tcp -&gt; 0.0.0.0:4321
9876/tcp -&gt; 0.0.0.0:1234

$ docker port test 7890/tcp

0.0.0.0:4321

$ docker port test 7890/udp

2014/06/24 11:53:36 Error: No public port '7890/udp' published for test

$ docker port test 7890

0.0.0.0:4321
</pre></div> <div class="_attribution">
  <p class="_attribution-p">
    &copy; 2019 Docker, Inc.<br>Licensed under the Apache License, Version 2.0.<br>Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>Docker, Inc. and other parties may also have trademark rights in other terms used herein.<br>
    <a href="https://docs.docker.com/engine/reference/commandline/port/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/port/</a>
  </p>
</div>