Connecting to a headless nREPL running in a Docker container from another container

You have to include :host 0.0.0.0 in the lein repl command to allow connections on a hostname/address other than 127.0.0.1:

lein repl :headless :host 0.0.0.0 :port 7888

You can include the port number as follows:

lein repl :headless :port 1234

If you are running on a Mac, you are probably behind boot2docker, so this article helped, a lot. Here is how I connected to the container:

lein repl :connect $(boot2docker ip):7888

And thanks to: What IP do I access when using docker and boot2docker?