即使我的节点应用程序在docker中运行并在端口3000上侦听,我也无法到达localhost:3000或127.0.0.1:3000。相反,我必须使用locahost:32779知道为什么吗?Docker文件...EXPOSE 3000...app.jsconst port = 3000app.get('/', (req, res) => res.send('Hello World!'))app.listen(port, () => console.log(`Example app listening on port ${port}!`))CMDdocker run -p 3000-3000 test --> Example app listening on port 3000!浏览器localhost -> This site can’t be reachedCMDdocker ps -a95d2ce8 test "/bin/sh -c 'node ap…" 3 minutes ago Up 3 minutes 0.0.0.0:32779->3000/tcp distracted_thompson
添加回答
举报
0/150
提交
取消