interactive terminal

The -it flags that connect your keyboard to a container and give it a terminal, so you can use a shell inside it.

In more detail

-i keeps standard input open so you can type; -t allocates a pseudo-terminal (TTY, from teletypewriter) so prompts and colours work. Together, docker run -it alpine:3.20 sh or docker exec -it name sh give you an interactive shell. Scripts and pipelines normally leave them off.

Examples

docker run -it --rm alpine:3.20 sh
echo login | docker exec -i broker rpk topic produce events

Related terms

Taught in

References