Which command starts an interactive Bash session in a new container using ubi7/ubi:7.7?

Prepare for the Red Hat OpenShift Developer II DO288 Exam with our quizzes. Study with flashcards and multiple choice questions, each with hints and explanations. Get ready for your certification!

Multiple Choice

Which command starts an interactive Bash session in a new container using ubi7/ubi:7.7?

Explanation:
To get an interactive Bash session in a new container, you need to allocate a TTY and keep STDIN open while running Bash inside the container. The -i (interactive) and -t (TTY) flags accomplish this, and they belong before the image name in the Podman run command. Then you specify the image (ubi7/ubi:7.7) and the shell to start inside the container, which should be /bin/bash for a Bash session. That combination is exactly: sudo podman run -it ubi7/ubi:7.7 /bin/bash. Why this works: -it sets up an interactive terminal by combining -i and -t, so you can type and see a terminal prompt inside the container. Running /bin/bash ensures you get the Bash shell. The other options fail for these reasons: placing -it after the image doesn’t apply the flags to Podman, so no TTY is allocated; using /bin/sh instead of /bin/bash may not provide Bash specifically; and using --interactive without a corresponding --tty may not give a usable interactive terminal.

To get an interactive Bash session in a new container, you need to allocate a TTY and keep STDIN open while running Bash inside the container. The -i (interactive) and -t (TTY) flags accomplish this, and they belong before the image name in the Podman run command. Then you specify the image (ubi7/ubi:7.7) and the shell to start inside the container, which should be /bin/bash for a Bash session. That combination is exactly: sudo podman run -it ubi7/ubi:7.7 /bin/bash.

Why this works: -it sets up an interactive terminal by combining -i and -t, so you can type and see a terminal prompt inside the container. Running /bin/bash ensures you get the Bash shell. The other options fail for these reasons: placing -it after the image doesn’t apply the flags to Podman, so no TTY is allocated; using /bin/sh instead of /bin/bash may not provide Bash specifically; and using --interactive without a corresponding --tty may not give a usable interactive terminal.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy