4-Docker命令之docker port

1.docker port介绍

docker port命令是用于列出docker容器的端口映射

2.docker port用法

docker port container [PRIVATE_PORT[/PROTO]]

[root@centos79 ~]# docker port --help

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

List port mappings or a specific mapping for the container

Aliases:
  docker container port, docker port
[root@centos79 ~]# 

3.实例

3.1.列出docker容器的端口映射

命令:

docker port 42574

[root@centos79 ~]# docker ps | grep centos-nginx
425747b4385b   centos-nginx:1.0       "nginx -g 'daemon of…"   4 days ago    Up About an hour   0.0.0.0:80->80/tcp, :::80->80/tcp                                                      centos-nginx
[root@centos79 ~]# docker port 42574
80/tcp -> 0.0.0.0:80
80/tcp -> [::]:80
[root@centos79 ~]# 

3.2.列出指定协议的docker容器端口映射

命令:

docker port 42574 80/tcp

[root@centos79 ~]# docker ps | grep centos-nginx
425747b4385b   centos-nginx:1.0       "nginx -g 'daemon of…"   4 days ago    Up About an hour   0.0.0.0:80->80/tcp, :::80->80/tcp                                                      centos-nginx
[root@centos79 ~]# docker port 42574 80/tcp
0.0.0.0:80
[::]:80
[root@centos79 ~]# 

你可能感兴趣的:(docker,容器)