Rails console fails to start in container

I get:

/app/fountain # bin/rails console
Loading production environment (Rails 5.2.2.1)
bin/rails: No such file or directory - infocmp
Traceback (most recent call last):
...
1: from /usr/local/bundle/gems/rb-readline-0.5.5/lib/rbreadline.rb:2027:in `_rl_init_terminal_io'
   .../lib/rbreadline.rb:1815:in `get_term_capabilities': undefined method `split' for nil:NilCla

when I start “rails console” in a container with a distroless ruby. This is because rails console wants to try to do colourization, etc, and the termcap database is probably not present.

Do: export TERM=dumb rails console

Or even put:

ENV TERM=dumb

in your Dockerfile. This will turn off all terminal controls. That includes emacs/vi-style line editing and history. If you want to restore this, you can put a few terminfo files, I don’t have a minimal set yet, as many of the files in /usr/share/terminfo depend upon other files. There is a way to store some of this into environment variables (or there was in the days of TERMCAP), but I’m not sure of the details yet.