Home > Docker > Terminal in docker exec a mess

Terminal in docker exec a mess

Fairly recently the terminal for docker exec has started to misbehave. When I enter a running Wildfly container to view the logs the output becomes garbled with less, vi and other tools. It appears the reason is that the terminal size is not detected (#33794). The solution on Linux/Mac is to pass in the size:


docker exec -e COLUMNS="`tput cols`" -e LINES="`tput lines`" -it imagename

Unfortunately that doesn’t work on Windows. The mode command can provide the columns, but not the number of lines, which must be hard-coded.

Advertisements
Categories: Docker
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: