0

I'm trying to use docker attach to attach to curses-based graphical process:

$ docker run --name irssi -it pandrew/irssi irssi

When you detach from this process using ^P^Q and reattach with docker attach irssi it looks like nothing happened. But, the process does reattach, because you can type commands and slowly you can build the graphical interface back up by triggering redraws. Nevertheless, the behavior of the process is strange after the re-attaching.

However, if you initially run the process inside a screen, everything works fine:

$ docker run --name irssi -it ${PREVIOUS_IMAGE_PLUS_SCREEN} screen irssi

You can detach and reattach from the container and something about screen causes the irssi session to behave fine. It appears that irssi has some capacity to check to see whether it's "dirty", and to redraw the screen: https://github.com/irssi/irssi/blob/master/src/fe-text/irssi.c#L123.

Can anyone help explain what's going on here? Thank you.

2

When you re-attach to a fullscreen app, that app needs to redraw. Screen is good at figuring out when it's re-attached, and re-drawing itself -- generally by listening for SIGWINCH which indicates that the terminal size has changed. It may have some additional functionality for monitoring its terminal that allows it to succeed here where irssi does not.

Based on the last suggestion in the irssi tips page, you should be able to type /redraw in irssi to redraw the screen, or bind that to ^L with /bind ^L redraw.

  • Thanks. Indeed, you can also just hit ^l (lowercase L) to redraw once you've connected. As a side note, if running in screen/tmux (say, on the Docker host), it's also important to set the TERM to screen-256colors for scrolling to work correctly. Otherwise scrolling is broken (not sure why, exactly). – Dmitry Minkovsky Oct 5 '14 at 23:17

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.