DEVCOR Exam QuestionsBrowse all questions from this exam

DEVCOR Exam - Question 150


A local Docker container with a Container ID of 391441516e7a is running a Python application.

Which command is used to connect to a bash shell in the running container?

A.

B.

C.

D.

Show Answer
Correct Answer:

To connect to a bash shell in a running Docker container, the correct command is to use `docker exec` with the `-it` flags, which stands for interactive terminal. This command allows you to execute a command inside the container, and `/bin/bash` specifies that you want to open a bash shell. Hence, the correct command is: `docker exec -it <Container ID> /bin/bash`.

Discussion

9 comments
Sign in to comment
moslig
Aug 22, 2022

option B connects a bash shell

lente_kriebels
Aug 22, 2022

Correct answer is B

Teringzooi
Sep 28, 2023

Correct answer: B docker run -it <image name> <command> docker exec -it ubuntu_bash bash https://phase2.github.io/devtools/common-tasks/ssh-into-a-container/

designated
Sep 8, 2023

B is correct > docker exec -it ubuntu_bash bash

__al__
Mar 13, 2023

B... no doubt!

ferock
Apr 30, 2023

B Next, execute an interactive bash shell on the container. docker exec -it ubuntu_bash bash https://docs.docker.com/engine/reference/commandline/exec/

Dave513
Oct 24, 2024

Correct option is B!

mariodevx
Oct 5, 2024

docker exec: run a command in a running container e.g. sudo docker exec -ti <container_name> /bin/bash log in to the running container through an interactive shell https://github.com/etture/dev_notes/issues/10

al_mon
Feb 5, 2025

docker exec -it 391441516e7a /bin/bash Explanation: docker exec: Used to execute a command in a running container. -it: Runs the command interactively and allocates a TTY (terminal). 391441516e7a: The ID of the running container. /bin/bash: Specifies that you want to open a Bash shell inside the container.