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?
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
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
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.
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
...
...
This section is not available anymore. Please use the main Exam Page.350-901 Exam Questions
Log in to ExamTopics
Sign in:
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.
jjkcoins
Highly Voted 1 year, 8 months agoTeringzooi
Most Recent 7 months, 3 weeks agodesignated
8 months, 2 weeks agostein861
1 year, 8 months agodexilec82
1 year, 2 months ago