Is anyone doing development using inf-clojure and lein to connect to a socket repl running in a Docker container? I can connect to the repl while inside the container, but when I try to connect from the host I get
telnet 0.0.0.0 5555
Trying 0.0.0.0...
Connected to 0.0.0.0.
Escape character is '^]'.
Connection closed by foreign host.
@davidneu have you set :address "0.0.0.0"
as a parameter to the socket repl?
-Dclojure.server.repl='{:port 5555 :accept clojure.core.server/repl :address "0.0.0.0"}'
@ghadi Thanks for the reply! I had actually tried setting :host in the jvm-opts in project.clj. I'm going to try your suggestion now.
how are you launching the repl?
I've tried a bunch of different options. I was about to try launching from the command option in my docker-compose.yml.
are you using lein to launch the repl? @davidneu
Yes. Is that what you suggest?
can you paste or DM the entrypoint from docker-compose.yml
and the relevant parts of project.clj
?
For a plain socket repl, you'd set that system property above in jvm-opts, and run lein run -m clojure.main
(or lein repl
which will give you a second repl using nREPL that you don't care about).
In docker-compose, you'll want to have a ports:
entry mapping "5555:5555"
Hmmmm, I must be close. That's what I've been trying to do. I'm go through it carefully now that you've confirmed I'm heading in the right direction, and can paste the files if need be.
@ghadi That worked - thank you! I really appreciate it. It looks like the problem was using setting :host "0.0.0.0" rather than :address "0.0.0.0". I recall looking at the source for clojure.core.server/start-server, so I don't know why I thought it was :host. Thanks again.