docker-clojure icon indicating copy to clipboard operation
docker-clojure copied to clipboard

Alpine images error on default entrypoint due to missing rlwrap

Open cap10morgan opened this issue 1 year ago • 2 comments

Due to #23

docker run clojure:tools-deps-alpine =>

/usr/local/bin/rlwrap: line 13: /usr/bin/rlwrap: not found

Could do any one of the following:

  • install rlwrap (kind of heavy for alpine)
  • wait for #230 to be ready and merged
  • switch to clojure as the entrypoint for alpine images.

cap10morgan avatar Sep 12 '24 20:09 cap10morgan

Would it make more sense for the default to be a shell prompt

  • clojure and clj provide a minimal repl UI
  • typing clojure code in a minimal repl ui within a docker container prompt seem very limited, especially compared to an editor connected REPL workflow
  • if running a repl process has the most value as the default entry point, then wouldn't it be even more valuable to include an nrepl server yo connect a local rdiyor
  • leiningen and Clojure CLI are both included in the default images, so having a shell (bash) prompt seems to be more appropriate
  • using clojure or clj in tool specific images means there is a different entrypoint and behaviour to the default image (assuming the above point holds true)
  • clojure and clj are typically used with aliases during development and there are a range of (for production the most common approach is to use an uberjar with the Java command)

There are many options even using clojure or clj as the default, so would using a shell prompt as the default be more flexible and simpler approach for all Clojure images?

practicalli-johnny avatar Sep 13 '24 01:09 practicalli-johnny

I agree with you on most or ever all points. However, the current entrypoint also allows executing Leiningen and tools.deps subcommands, e.g.:

$ docker run --rm -ti clojure:temurin-22-lein-2.11.2-jammy help
Leiningen is a tool for working with Clojure projects.

Several tasks are available:
change              Rewrite project.clj with f applied to the value at key-or-path.
check               Check syntax and warn on reflection.
classpath           Write the classpath of the current project to output-file.
clean               Removes all files from paths in clean-targets for a project
compile             Compile Clojure source into .class files.
...

Somebody might be reliant on this behavior, so I guess we are kinda stuck with supporting this (if compatibility is a priority). I'm not a fan of this approach either but it is what it is.

We can, theoretically, keep this behavior but change the default command from say lein repl to bash if no arguments are provided to the docker run command. It's just that the entrypoint script is already pretty complicated, I'm not sure if adding more complexity to it is a good thing.

alexander-yakushev avatar Sep 13 '24 07:09 alexander-yakushev

OK now that #240 has landed I'm working on this.

  1. The fix for this is simple; we just start installing rlwrap in alpine tools-deps variants again. That's in #253.
  2. The way the ENTRYPOINT works in here is (was?) the recommended approach for Docker Official Images. I've been trying to track down the docs on it, but can't find them now. Or if I discover that the recommendation has changed, I'll update it.

cap10morgan avatar Apr 30 '25 15:04 cap10morgan

Here are the docs I was trying to find: https://github.com/docker-library/official-images#consistency

This is why our ENTRYPOINTs and CMDs work the way they do.

cap10morgan avatar Apr 30 '25 17:04 cap10morgan