Running docker container not accessible from host (localhost:8081)
Based on this:
https://github.com/webpack/webpack-dev-server/issues/547
and:
https://pythonspeed.com/articles/docker-connection-refused/
It works if I change:
host: 'localhost', // can be overwritten by process.env.HOST
to:
host: '0.0.0.0', // can be overwritten by process.env.HOST
in the file: /frontend-router/config/index.js
When you have connection reset
it means usually that nobody is listen on the port .
It seems you are listening on localhost
, you must listening on 0.0.0.0 when you are in the docker .
in your file config/index.js
, host
is localhost
, you must remove the host
directive
If you listening on 127.0.0.1
or localhost
, you are listening on local network , so inside the container , the web server can be accessed only by local process .
Another source of problems you can have , you are connecting to the wrong port .
if you run with docker run -it -p 8081:8080
you must acces to http://localhost:8081/
see
Publish or expose port (-p, --expose) from https://docs.docker.com/engine/reference/commandline/run/