I'm trying to connect to an nREPL from a Docker container that is running another, linked Docker container on port 7888. Despite exposing the port with -p 7888
, linking the container with -link <first_container_name>:repl
and using the Docker-injected environment host and port variables, I am getting a "Connection refused." error.
Here's how I run the first container:
docker run -i -t -p 7888 clojure-image lein repl :headless :port 7888
~$ nREPL server started on port 55555 on host 127.0.0.1
And the second container:
docker run -i -t -link <first_container_name>:repl clojure-image /bin/bash
username@hostname~$ lein repl :connect 172.0.2.1:7888
Why is my connection being refused? I am able to connect other services like AMQP between Docker containers.