exam questions

Exam 701-100 All Questions

View all questions & answers for the 701-100 exam

Exam 701-100 topic 1 question 30 discussion

Actual exam question from LPI's 701-100
Question #: 30
Topic #: 1
[All 701-100 Questions]

Given the following excerpt of a Dockerfile:
Run apt-get ""y update && apt-get install ""y fortunes && apt-get clean
Why are the multiple apt-get commands combined in one RUN statement instead of using multiple RUN statements?

  • A. To prevent the commands from running in parallel because Docker executes all RUN statements in their own container at the same time.
  • B. To ensure the execution order of the commands because Docker might evaluate the statements of a Dockerfile in any order.
  • C. To avoid the creation of unnecessary images because Docker creates a new image for each RUN statement.
  • D. To execute both commands in the same container instance and void Docker to reset the container to the original base image.
  • E. To execute the apt-get install command only if the apt-get update command was successful because Docker does not check the success of RUN statements.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
ayuuk
Highly Voted 4 years, 8 months ago
Correct is C. Minimize the number of layers In older versions of Docker, it was important that you minimized the number of layers in your images to ensure they were performant. The following features were added to reduce this limitation: Only the instructions RUN, COPY, ADD create layers. Other instructions create temporary intermediate images, and do not increase the size of the build. Where possible, use multi-stage builds, and only copy the artifacts you need into the final image. This allows you to include tools and debug information in your intermediate build stages without increasing the size of the final image.
upvoted 6 times
fredurst
4 years, 4 months ago
hello,can i find another practice exam
upvoted 2 times
...
...
SCI_FI
Most Recent 7 months, 4 weeks ago
I think is D.
upvoted 1 times
...
[Removed]
2 years, 6 months ago
Selected Answer: C
Correct is C
upvoted 1 times
...
[Removed]
3 years ago
From: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers Only the instructions RUN, COPY, ADD create layers. Other instructions create temporary intermediate images, and do not increase the size of the build.
upvoted 1 times
...
gilbertlelancelo
3 years, 1 month ago
Ans D. Using RUN apt-get update && apt-get install -y ensures your Dockerfile installs the latest package versions with no further coding or manual intervention. This technique is known as “cache busting”. You can also achieve cache-busting by specifying a package version. This is known as version pinning, https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
upvoted 2 times
...
Blob21
3 years, 2 months ago
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
upvoted 2 times
...
hmagroun
4 years, 5 months ago
"C" is the correct answer
upvoted 2 times
...
hector1978
4 years, 7 months ago
I agree, the correct answer is C
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