Update:
Thanks for pointing out the shortcomings of my previous answer.
The user's problem with the terminal in a remote machine and the problem I faced in a docker container may be caused by the same issue, which is related to the terminfo (about terminfo).
- The
USERA account works well in that machine may set up terminfo correctly while another USERB account doesn't. So using USERA's terminfo may fix this problem.
But, where is the terminfo?
- Here is what I found in a
ubuntu:20.04 docker container:
root@9a6c3b2bf6ea:/etc/terminfo# cat README
This directory is for system-local terminfo descriptions. By default,
ncurses will search ${HOME}/.terminfo first, then /etc/terminfo (this
directory), then /lib/terminfo, and last not least /usr/share/terminfo.
Solution:
- Check the following locations and find the
terminfo you need:
${HOME}/.terminfo (associated with accounts, check this one first)
/etc/terminfo
/lib/terminfo
/usr/share/terminfo
- Copy the
terminfo from USERA to USERB
- Open a new session to refresh your terminal
Original Answer:
I encountered this problem when I tried to add bash and use it in a distroless image. (Even though this behavior is unsafe ...)
I build my application image with the multi-stages build.
I run:
docker run -it <my_image> bash
And I found that <backspace> doesn't work.
Solution:
In my Dockerfile:
COPY --from=builder /lib/terminfo /lib/terminfo
- echo $TERM
- stty -a
– paul Aug 16 '12 at 04:13TERMwasalacrittyand changing it tovt100worked. On a different server on AWS I got a warning regarding the wrongTERM. Why does that happen? Does it depend on the ssh server? – Steve Chavez Sep 03 '20 at 18:59st-256color. Trying to set it in debian results in error, but settingvt100as sugested here fixed backspace and tab. – ultraSsak Dec 24 '20 at 01:03