Course
data-engineering-zoomcamp
Question
What's the difference between i and t in docker run -it?
Answer
When running containers interactively, Docker provides two commonly used flags: -i (interactive) and -t (tty). They are often used together as -it, but they serve different purposes.
-i keeps the container’s STDIN open, even if it is not attached to a terminal. This allows you send input to the process running inside the container.
echo "print(2+2)" | docker run -i python
-t allocates a pseudo-terminal (TTY) for the container. This provides proper terminal formatting (line breaks, colors, prompts).
docker run -t ubuntu date
Using both flags together gives you 1) an open input stream and 2) a real terminal interface. This is what you normally want for an interactive shell session.
docker run -it ubuntu bash
Checklist
Course
data-engineering-zoomcamp
Question
What's the difference between
iandtindocker run -it?Answer
When running containers interactively, Docker provides two commonly used flags: -i (interactive) and -t (tty). They are often used together as -it, but they serve different purposes.
-ikeeps the container’s STDIN open, even if it is not attached to a terminal. This allows you send input to the process running inside the container.-tallocates a pseudo-terminal (TTY) for the container. This provides proper terminal formatting (line breaks, colors, prompts).Using both flags together gives you 1) an open input stream and 2) a real terminal interface. This is what you normally want for an interactive shell session.
Checklist