Say I run this Docker command in one Terminal window:
$ docker run --name stackoverflow --rm ubuntu /bin/bash -c "sleep 5"
And before it exits I run this in a second Terminal window:
$ docker run -it --rm --pid=container:stackoverflow terencewestphal/htop
I'll successfully see htop
running in the second container, displaying the bash sleep process running. So far so good.
After 5 seconds, the first container will exit with code 0
. All good.
At this time, the second container will exit with code 137
(SIGILL). This also makes sense to me since the second container is just attached to the first one.
The problem is that this messes up macOS's Terminal.app
's state:
- The Terminal's cursor disappears.
- Clicking the Terminal window causes mouse location characters to be entered as input.
I'm hoping to find a way to avoid messing up Terminal.app
state. Any suggestions?