Cannot access nodejs app on browser at localhost:4200 (docker run -p 4200:4200 …)

左心房为你撑大大i 提交于 2019-12-06 08:43:22

EDIT

https://stackoverflow.com/a/48286174/2663059

Has the solution.

EDIT

First of all . Why you have done this .

#EXPOSE 4200

in Dockerfile. # in front means comment in dockerfile . Use this

 EXPOSE 4200

#EXPOSE 4200 means you have not expose the port .

And next check that container running your node server inside the Docker or not. How can you check is this. docker exec -it nept0 bash or can try

docker exec -it nept0 /bin/bash

Then you can run

curl localhost:4200 or the get api of the node.js if that working fine your node is working fine #EXPOSE 4200 was culprit .

You can read for docker exec here more https://docs.docker.com/engine/reference/commandline/exec/

Let me know if any issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!