0

Suppose I have container that run bash interactively with one of the following way:

  • docker run -it <image> /bin/bash.
  • docker start <stopped_container> and then docker attach <container>.

When I want another interactively session I do the next command: docker exec -it <container> /bin/bash. All seems to be fine but the terminal window is small:

enter image description here

How can I expand new interactively bash terminal session to desired size?

0

This could be done using stty program that changes and prints terminal line settings.

Suppose I want to get equal terminal sizes for bash session which I started with docker run -it ... or docker attach ... and bash session which I started with bash exec -it.

Firstly I I should get current terminal size for the first terminal:

bash-4.2# stty size
68 317

The I should set equal values for the second terminal:

bash-4.2# stty size # check current terminal size before (it's not required)
0 0
bash-4.2# stty rows 68
bash-4.2# stty cols 317

Now, the terminal size is equal for both terminals: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.