知识卡片
发布端口先主机后容器
Docker的-p HOST_PORT:CONTAINER_PORT把主机入口转发到容器监听端口。原书将X/Y解释反了,80:80恰好掩盖错误;不同端口时必须按职责核对,服务还须监听适当接口。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 依赖管理实践
原书出处 · 1 处
- · 查看原书依据
-p X:Y tells Docker to publish port X in the Docker container onto port Y on the host. This allows you to send requests from outside the container to a server running inside the container on port 80.
参考来源
- 位置:《Effective Machine Learning Teams (David Tan, Ada Leung, David Colls)》第04章《依赖管理实践》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Effective Machine Learning Teams (David Tan, Ada Leung, David Colls)/_epub-src/OEBPS/ch04.html)
- 结论依据:摘录中关于发布端口先主机后容器的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:-p X:Y tells Docker to publish port X in the Docker container onto port Y on the host. This allows you to send requests from outside the container to a server running inside the container on port 80.