1. docker port

1.1. 描述

docker port 命令用于列出指定容器的端口映射关系,或者配置端口映射。

1.2. 帮助

$ docker port --help

Usage: docker port CONTAINER [PRIVATE_PORT[/PROTO]]

List port mappings or a specific mapping for the container

1.3. 示例

  • 查看所有的端口映射关系
$ 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->9876/tcp, 0.0.0.0:4321->7890/tcp test

$ docker port test
7890/tcp -> 0.0.0.0:4321
9876/tcp -> 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
Copyright © 温玉 2021 | 浙ICP备2020032454号 all right reserved,powered by Gitbook该文件修订时间: 2022-03-13 11:28:02

results matching ""

    No results matching ""