I’ve been using docker for a while now, but the other day I got tripped by a trivial mistake.
It turns out that if you forget the
-i, --interactive parameter while trying to run an interactive shell, the console will “freeze”. If you are lucky you will get a warning, like this one
WARNING: your terminal doesn't support cursor position requests (CPR). which I got from
ipython. Trying to run the plain
python shell or
/bin/bash interactively without the
-i parameter will just not work, and you won’t know why.
A friendly reminder for myself, so I never forget the
This is how you launch a container with an interactive shell:
docker run -it --rm <image-name-or-id> ipython or podman run -it --rm <image-name-or-id> /bin/bash
-i, --interactive Keep STDIN open even if not attached -t, --tty Allocate a pseudo-TTY --rm Automatically remove the container when it exits