Docker port isn't accessible from host Docker port isn't accessible from host curl curl

Docker port isn't accessible from host


I had a similar problem, in which specifying a host IP address as '127.0.0.1' wouldn't properly forward the port to the host.

Setting the web server's IP to '0.0.0.0' fixes the problem

eg - for my Node app - the following doesn't work

app.listen(3000, '127.0.0.1')

Where as the following does work:

app.listen(3000, '0.0.0.0')

Which I guess means that docker, by default, is exposing 0.0.0.0:containerPort -> local port


You should run with docker run -P to get the ports to map automatically to the same values to set in the Dockerfile.. Please see http://docs.docker.com/reference/run/#expose-incoming-ports