exam questions

Exam 350-901 All Questions

View all questions & answers for the 350-901 exam

Exam 350-901 topic 1 question 344 discussion

Actual exam question from Cisco's 350-901
Question #: 344
Topic #: 1
[All 350-901 Questions]

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?

  • 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
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Pina7
1 month, 3 weeks ago
Selected Answer: C
From AI: In Docker, docker exec requires the container’s name (set via --name during docker run) or its ID. The original command (docker run -d devcorapp) doesn’t specify a name, so Docker assigns a random name (not devcorapp). Using devcorapp here would likely fail unless the container was explicitly named devcorapp (not shown). Fit: Incorrect; devcorapp is the image name, not the container identifier.
upvoted 1 times
Pina7
1 month, 3 weeks ago
That is the explanation way not B
upvoted 1 times
...
...
samael666
3 months, 2 weeks ago
Selected Answer: C
to run docker exec we need container id or name, not image name as option A
upvoted 1 times
...
williamluo
5 months, 1 week ago
Selected Answer: C
However, devcorapp is the image name, not the container ID or name. Since it doesn't target the running container correctly, this command would fail.
upvoted 1 times
williamluo
5 months, 1 week ago
revoke, the correct answer should be B, since don't know where is c573okec2hf from.
upvoted 1 times
...
...
[Removed]
1 year ago
To start an interactive Bash shell in the running container, the correct command is: B. docker exec -it devcorapp /bin/bash This command uses docker exec to execute a new command in a running container. The -it flags attach an interactive tty in the container, and devcorapp is the name of the container where the Bash shell is to be started. /bin/bash is the command to start the Bash shell.
upvoted 1 times
...
razvan999
1 year, 4 months ago
Selected Answer: C
docker run -d <image_name>...if you want to set the container name you have to use --name
upvoted 2 times
...
VincentVega
1 year, 7 months ago
Selected Answer: B
Excuse me... Please look exact question The “devcorapp” container so B is correct
upvoted 3 times
...
VincentVega
1 year, 7 months ago
Selected Answer: C
It looks as answer's mistyped... Both B and C can be correct. To start an interactive Bash shell in a Docker container, you can use the docker exec command that allows developers to execute commands in running containers. $ docker exec -it <container> bash Where container is either the name or the identifier of a Docker container that can be obtained using the docker ps command. B can be correct, but devcorapp not the same as devcorapp2 So C can be correct and again - The short container ID represents the first 12 characters of the full container ID. At answer only 11 characters without starting 2
upvoted 3 times
...
Pecoto
1 year, 9 months ago
I thinks its C on run command it is created container DEVCORAPP2 where is not DEVCORAPP originally in B also I research you can call Docker exec command with containerID witch is stated in run command I dont have hens on experience with containers can some one verify this?
upvoted 1 times
...
johntermlen
1 year, 9 months ago
Selected Answer: B
The answer is B. docker exec -it devcorapp /bin/bash. The docker run command is used to create and start a container. The -d option tells Docker to run the container in detached mode. This means that the container will run in the background and you will not be able to interact with it directly. The docker exec command is used to execute a command inside a running container. The -it option tells Docker to allocate a pseudo-TTY connected to the container's standard input (i.e. stdin). The /bin/bash command is used to start an interactive Bash shell in the container. Therefore, the command to start an interactive Bash shell in the running container is docker exec -it devcorapp /bin/bash
upvoted 1 times
...
Ietsmeteennaam
1 year, 11 months ago
Looking at the documentation (https://docs.docker.com/engine/reference/commandline/exec/) it should be B.
upvoted 1 times
...
tor123
1 year, 11 months ago
Selected Answer: B
container is already running so answer is B
upvoted 1 times
...
[Removed]
1 year, 12 months ago
Answer C, you can access shell in the container that is already running
upvoted 4 times
...
Alexissiox
2 years ago
Selected Answer: B
docker run is for running a new container. Here the container has already been run. docker exec -i (interactive mode) -t devcorapp /bin/bash
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago