node.js - Docker Node JS Installation -


i brand new docker , attempting follow node js tutorial have listed: https://docs.docker.com/examples/nodejs_web_app/

i follow tutorial , seems work great until test portion , can't curl port specified.

$ curl -i localhost:49160 curl: (7) failed connect localhost port 49160: connection refused  $ docker ps container id        image                          command                created             status              ports                     names 21e727bc5a7d        username/docker-test   "node /src/index.js"   13 minutes ago      13 minutes       0.0.0.0:49160->8080/tcp   gloomy_heisenberg $ docker logs 21e727bc5a7d  running on localhost:8080  $ docker exec -it 21e727bc5a7d bash [root@21e727bc5a7d /]# netstat -tulpn  active internet connections (only servers) proto recv-q send-q local address foreign address state pid/program name  tcp 0 0 0.0.0.0:8080 0.0.0.0:* listen 1/node' 

not sure if confused or how troubleshoot this, ideas?

this solution:

  1. run application this:

    docker run --rm -i -t -p 49160:8080 <your username>/centos-node-hello

    an output should come saying listening port 8080. means application running

  2. open docker cli terminal , type:

    docker-machine ls

    you see , ip address , port. example: 192.168.99.100:<some-number>

  3. go browser , type ip address , exported port number.

    in case, 192.168.99.100:49160, , website should come on.

hope helps.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -