-i flag to keep STDIN open, the container accepts input:
-i run above the original prompt text (“Welcome! Please enter your name:”) is missing. Many programs only print interactive prompts when they detect they’re attached to a terminal (a TTY). To make programs inside the container behave as if they have a real terminal, allocate a pseudo-TTY with the -t flag.
-ikeeps STDIN open so the container can receive input.-tallocates a pseudo-TTY so programs behave like they are running in a real terminal (show prompts, colors, progress UIs).-it(or-ti) combines both: keeps STDIN open and allocates a TTY.
- Use
-ialone when you need to stream or pipe data into the container (STDIN must be connected, but you don’t need a terminal). Example:
-
Use
-talone when you want the containerized process to think it’s running in a terminal (so it emits colored output, progress bars, etc.), but you don’t need to type into it yourself. -
Use
-itfor interactive shells and most CLI interactions where both input and terminal behavior are required (e.g., bash shells, interactive installers).
Further reading
Use
-i to keep STDIN open, use -t to allocate a pseudo-TTY, and combine them as -it when you need both interactive input and terminal-like behavior. For streaming or pipelines, prefer -i without -t.