Developing Applications Using Cisco Core Platforms and APIs (DEVCOR) — Question 319
A developer is working on containerizing an application. The “devcorapp” container has been run in detached mode to output the container ID with the command:
1 $ docker run -d devcorapp2 2c573okec2hf6756he4441115314ge859299er674f74313426ff9h535
Which command is used to start an interactive Bash shell in the running container?
Answer options
- A. docker run -it c573okec2hf /bin/bash
- B. docker exec -it devcorapp /bin/bash
- C. docker exec -it c573okec2hf /bin/bash
- D. docker run -it devcorapp /bin/bash
Correct answer: C
Explanation
The correct answer is C because 'docker exec -it c573okec2hf /bin/bash' allows you to open an interactive shell in a running container using its container ID. Option A incorrectly tries to run a new container instead of accessing the running one, while option B addresses the container by name, which is not the ID provided, and option D attempts to create a new instance of the container instead of connecting to the existing one.