Docker runs a separate Docker host (small footprint Linux VM) on Mac which is different from main machine. So any port which maps to container to host machine, cannot be accessed by localhost
. Instead it has to use docker host is.
Here is how you can get docker host ip on Mac
## docker-machine ip vm_name $ docker-machine ip default
To get names of all docker machines, you can use
docker-machine ls NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1