What is the purpose of the "i" flag when running the 'docker run' command?

Study for the Kubernetes Cloud Native Associate (KCNA) Certification. Prepare with flashcards and multiple choice questions. Ensure success with detailed explanations. Ready for your exam!

Multiple Choice

What is the purpose of the "i" flag when running the 'docker run' command?

Explanation:
The i flag makes the container interactive by keeping the standard input open so you can send input to the processes running inside. This is what allows you to type commands into a shell inside the container when you attach to it. In practice, you often pair it with the -t flag to get a real terminal (for example, docker run -it ubuntu bash). Without this flag, a shell would not receive your keystrokes as input in an interactive session. The other options in the question relate to detaching from the terminal or allocating a pseudo-TTY, which are different behaviors.

The i flag makes the container interactive by keeping the standard input open so you can send input to the processes running inside. This is what allows you to type commands into a shell inside the container when you attach to it. In practice, you often pair it with the -t flag to get a real terminal (for example, docker run -it ubuntu bash). Without this flag, a shell would not receive your keystrokes as input in an interactive session. The other options in the question relate to detaching from the terminal or allocating a pseudo-TTY, which are different behaviors.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy