How to access Docker container's web server from host

Extending Anentropic's answer: boot2docker is the old app for Mac and Windows, docker-machine is the new one.

Firstly, list your machines:

$ docker-machine ls

NAME      ACTIVE   DRIVER       STATE     URL                         SWARM
default   *        virtualbox   Running   tcp://192.168.99.100:2376

Then select one of the machines (the default one is called default) and:

$ docker-machine ip default

192.168.99.100

Ok, stupid me, I found the answer in the docs for boot2docker https://docs.docker.com/installation/mac/#container-port-redirection

I needed to use the ip address of the boot2docker vm, rather than the ip of the container, i.e.

$ boot2docker ip
192.168.59.103

and I am able to browse my site from the host at http://192.168.59.103:49159/

I did not need to add any route on the host


To find the IP address of your container, you should need NO additional installs:

docker inspect <container>

This provides a wealth of info. grep it for the IPAddress.