I tried to run a CouchDB inside boot2docker on OSX.
docker run -d -p 5984:5984 --name couchdb tutum/couchdb
The container was running but nevertheless I couldn't connect to http://localhost:5984/.
Mmh? docker logs <containerId> showed alternating logs telling me that the DB is started or starting. Weird, time to find out what's up:
boot2docker ssh cd / find . -name "couch.log" less ./mnt/sda1/var/.../usr/local/var/log/couchdb/couch.log
VBoxManage controlvm boot2docker-vm natpf1 "couchdb,tcp,,5984,,5984"
This line will forward the port from the VBox to my machine. Worked!
A more generic solution
I found out that boot2docker will be replaced with boot2docker-cli. If you initialize a new virtual machine with this tool, it will add a host only interface, via which you will be able to access a Docker container's ports with no extra configuration.