Hi everybody!
I spent a day to solve the issue and I found some trick:
I tried to deploy angular app (https://github.com/angular/angular-phonecat) in docker container in my Win10 by command
docker run -p 8000:8000 <other-stuff>
As described, locally project work fine.
Even inside container everything works fine(I checked by executing curl request inside container):
docker exec -it <container> bash -c 'curl http://localhost:8000'
But outside of container I still had the same issue as in posts above. page cannot be reached
Finally
The node.js app uses node http-server (https://www.npmjs.com/package/http-server) that allow you get name to host (“host1”, “myhost”, “localhost”) and that it start command from package.json:
"start": "http-server ./app -a localhost -p 8000 -c-1",
Intresting, because by default node http-server use 0.0.0.0 that bind adress to real localhost ( flag -a look at npm documentation ) So when you start your container you can connect to 127.0.0.1 and localhost inside docker.
But if you use -a localhost flag, you create alias for adress and localhost it is not real localhost(127.0.0.0) and you can’t get it outside of container.
Try to change your start script for using default adress (without -a flag)
"start": "http-server ./app -p 8000 -c-1",
It works for me, maybe it helps you.