Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我调用该命令时,我docker ps所有正在运行的 docker 容器都会被列出。除其他外,端口映射显示在PORTS列中。
docker ps
我不知道这个符号: 5432/tcp和那个符号:0.0.0.0:5432->5432/tcp之间有什么区别。
5432/tcp表示5432端口暴露在容器中
当您在 Dockerfile 中公开 5432(或您想要的任何端口)时,它将告诉 Docker 您的容器服务可以连接到容器的端口 5432。
0.0.0.0:5432->5432/tcp表示主机端口5432映射到容器端口5432
当您发布任何端口时,来自主机端口的任何流量都将转发到已发布的容器端口。