github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/docs/reference/commandline/port.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "port"
     4  description = "The port command description and usage"
     5  keywords = ["port, mapping, container"]
     6  [menu.main]
     7  parent = "smn_cli"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # port
    12  
    13      Usage: docker port [OPTIONS] CONTAINER [PRIVATE_PORT[/PROTO]]
    14  
    15      List port mappings for the CONTAINER, or lookup the public-facing port that is
    16  	NAT-ed to the PRIVATE_PORT
    17  
    18        --help          Print usage
    19  
    20  You can find out all the ports mapped by not specifying a `PRIVATE_PORT`, or
    21  just a specific mapping:
    22  
    23      $ docker ps
    24      CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                            NAMES
    25      b650456536c7        busybox:latest      top                 54 minutes ago      Up 54 minutes       0.0.0.0:1234->9876/tcp, 0.0.0.0:4321->7890/tcp   test
    26      $ docker port test
    27      7890/tcp -> 0.0.0.0:4321
    28      9876/tcp -> 0.0.0.0:1234
    29      $ docker port test 7890/tcp
    30      0.0.0.0:4321
    31      $ docker port test 7890/udp
    32      2014/06/24 11:53:36 Error: No public port '7890/udp' published for test
    33      $ docker port test 7890
    34      0.0.0.0:4321