使用docker port命令进行查看
# 查看容器的ID
[root@nccztsjb-node-27 ~]# docker ps | grep nginx 78e7140c0b8c goharbor/nginx-photon:v2.6.1 "nginx -g 'daemon of…" 2 months ago Up 2 months (healthy) 0.0.0.0:80->8080/tcp, :::80->8080/tcp nginx 3327bc10a1ba goharbor/harbor-portal:v2.6.1 "nginx -g 'daemon of…" 2 months ago Up 2 months (healthy) harbor-portal [root@nccztsjb-node-27 ~]#
# 78e7140c0b8c是容器的ID
[root@nccztsjb-node-27 ~]# docker port 78e7140c0b8c 8080/tcp -> 0.0.0.0:80 8080/tcp -> :::80
# 也可以用容器的名字
[root@nccztsjb-node-27 ~]# docker port nginx 8080/tcp -> 0.0.0.0:80 8080/tcp -> :::80 [root@nccztsjb-node-27 ~]#
docker port的输出中,左边额一列,箭头的左边是容器内的端口号,箭头的右边是在宿主机上映射出来的端口好,绑定到哪个IP,哪个具体的端口上了。
标签:8080,映射,0.0,宿主机,端口,tcp,nginx,80 From: https://www.cnblogs.com/chuanzhang053/p/17611079.html