'Tmux running inside Docker container prints ^[[A, ^[[B, ^[[C, and ^[[D for arrow keys

I have a docker container running on an ubuntu machine; however, when I run tmux inside that docker container, there are several symptoms:

  1. the prompt string changes to $ (as in this question)
  2. the up and down arrow keys print ^[[A and ^[[B instead of scrolling through command history
  3. the tab key does not do auto-completion as expected, but rather prints an actual tab.

Colors are displaying fine.

My .tmux.conf contains the following: set -g default-terminal "screen-256color"

My environment variables (within the docker container) should be set correctly. LANG=en_US.UTF-8 $TERM='screen-256color'

I have tried tmux -u new, as in the question linked above.

I am ssh-ing into this ubuntu machine via my local machine's terminal.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source