Archive

Archive for the ‘Docker’ Category

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