
Answer-first summary for fast verification
Answer: Use a slimmed-down base image like Alpine Linux, Copy the source after the package dependencies (Python and pip) are installed
The correct answers are C and E. Using a slimmed-down base image like Alpine Linux (C) helps reduce the size of the Docker image, which can lead to faster deployment times. Additionally, copying the source code after installing the package dependencies (E) makes use of Docker's layer caching mechanism. Since dependencies change less frequently than the application source code, this allows subsequent builds to reuse cached layers for dependencies and only build new layers for the changed source code, thereby speeding up the build process.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
One of the developers on your team deployed their application in Google Container Engine using a Dockerfile. They report that their application deployments are taking too long. The Dockerfile includes installing Python and dependencies from a requirements.txt file. You want to optimize this Dockerfile for faster deployment times without adversely affecting the application's functionality. Which two actions should you take? (Choose two.)
A
Remove Python after running pip
B
Remove dependencies from requirements.txt
C
Use a slimmed-down base image like Alpine Linux
D
Use larger machine types for your Google Container Engine node pools
E
Copy the source after the package dependencies (Python and pip) are installed
No comments yet.