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:
find . -name "couch.log"
Ok, the DB was up and running. Double checked it with curl http://0.0.0.0:5984/ and started to search. It found an docker issue describing a solution:
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.