Fix for terminal window columns and rows mismatch inside the container

(Colin Marshall) #1

I have figured out a simple workaround to a problem that was driving me CRAZY with the Docker container. Whenever I run ./launcher enter app, the columns and rows of the shell session from inside the container never matched my terminal window (I use iTerm2). This would make any command of medium or greater length wrap onto the same line, which made it very difficult to use. Running queries was especially bad.

I found a little trick on GitHub from user arielpontes to fix this.

I still get this all the time running Docker on Mac. I realized that if I simply resize the terminal window after attaching to the container, the problem is fixed.

Very simple workaround that I never thought of doing. :man_facepalming: Hope this helps somebody else.


(Jay Pfaffman) #2

You mean that all I’ve needed to do is resize the window?

(Colin Marshall) #3

Yup! Test it out and let me know if it works.

From another GitHub issue it looks like the launcher script could possibly be modified to send the columns and rows so you wouldn’t need to resize:

(Jay Pfaffman) #4

You have changed my life dramatically for the better.

I’ll add to my list submitting a PR to pass the size. It looks simple enough that I could do it. :wink:

docker run --rm -it -e COLUMNS=$COLUMNS -e LINES=$LINES -e TERM=$TERM -it ubuntu:16.04 tput lines