Tmux
Installing tmux (from inside your container)
apt-get install tmux
Installing tmuxinator (from inside your container)
apt-get install tmuxinator
When trying to start tmux or tmuxinator, you might see this error:
open terminal failed: not a terminal
If you see this it’s likely you’ve used docker exec -it IMAGE_NAME /bin/bash
instead of docker attach IMAGE_NAME
to open up a shell for your running container. Get out of the container prompt by typing exit
then run the “attach” command to open a new prompt. Tmux should work after doing that. See https://github.com/docker/docker/issues/728 and https://github.com/docker/kitematic/issues/1427 for more details.
When trying to start tmux or tmuxinator, you also might see these errors:
create pane failed: pane too small
can't find pane 1
These can be fixed by setting your $TERM variable appropriately. To see what the value is currently, you can run:
echo $TERM
This value might be something like xterm
by default. To remove the above errors, try updating this value:
export TERM=xterm-256color
If you’re writing a script that relies on docker exec
and you still want to be able to use tmux, you’re in luck. Try:
docker exec -ti YOUR_CONTAINER_NAME script -q -c "/bin/bash" /dev/null
Credit MichaelBitard
Screen
Installing screen (from inside your container)
apt-get install screen
When trying to start screen you may say an error similar to:
Must be connected to a terminal.
Like the solution above for tmux, try opening the shell using docker attach IMAGE_NAME
instead of using docker exec
.