When I launch a docker container using the exec command inside tmux, I occasionally experience odd behaviors in the terminal:

  1. The size of the terminal within a container is not the same as the size of the tmux pane.
  2. When I search for a command history with the upper arrow key, the searched command would not be displayed in the terminal.

Here is the solution for the behavior. I basically pass the size of the terminal that a container should create.

$ docker exec -ti --env COLUMNS=`tput cols` --env LINES=`tput lines` junyonglee_tf /bin/zsh

Leave a comment