exam questions

Exam 350-901 All Questions

View all questions & answers for the 350-901 exam

Exam 350-901 topic 1 question 167 discussion

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


Refer to the exhibit. Which additional line results in the output of Test 1 upon execution of the docker run --rm devnet 1 command in a Dockerfile with this content?

  • A. CMD [ג€/bin/echoג€, ג€Test1ג€]
  • B. RUN [ג€/bin/echoג€, ג€Test1ג€]
  • C. ENTRYPOINT [ג€/bin/echoג€, ג€Test1ג€]
  • D. CMD [ג€/bin/echo Test1ג€]
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
jjkcoins
Highly Voted 1 year, 8 months ago
C https://docs.docker.com/engine/reference/builder/#entrypoint
upvoted 6 times
...
Teringzooi
Most Recent 7 months, 3 weeks ago
Selected Answer: C
Correct answer: C An ENTRYPOINT allows you to configure a container that will run as an executable. For example, the following starts nginx with its default content, listening on port 80: docker run -i -t --rm -p 80:80 nginx https://docs.docker.com/engine/reference/builder/#entrypoint
upvoted 2 times
...
designated
8 months, 2 weeks ago
Selected Answer: C
C is correct since the last line will disable the bash: Command line arguments to docker run <image> will be appended after all elements in an exec form ENTRYPOINT, and will override all elements specified using CMD. This allows arguments to be passed to the entry point, i.e., docker run <image> -d will pass the -d argument to the entry point. You can override the ENTRYPOINT instruction using the docker run --entrypoint flag. The shell form prevents any CMD or run command line arguments from being used, but has the disadvantage that your ENTRYPOINT will be started as a subcommand of /bin/sh -c, which does not pass signals. This means that the executable will not be the container’s PID 1 - and will not receive Unix signals - so your executable will not receive a SIGTERM from docker stop <container>. Only the last ENTRYPOINT instruction in the Dockerfile will have an effect. https://docs.docker.com/engine/reference/builder/#entrypoint
upvoted 2 times
...
stein861
1 year, 8 months ago
I say A because ENTRYPOINT is better suited to run the same executable every time (in combo with CMD). This question shows a removal so CMD ["/bin/echo", "Test1"] would be sufficient since once it's removed, you don't need to execute anymore.
upvoted 2 times
dexilec82
1 year, 2 months ago
If my understanding is correct, CMD in dockerfile will be ignored because of the arguments are present on the docker run command so C is correct, ENTRYPOINT is not ignored. https://www.bmc.com/blogs/docker-cmd-vs-entrypoint/#:~:text=CMD%20commands%20are%20ignored%20by,as%20arguments%20of%20the%20command.
upvoted 1 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