PROFESSIONAL-CLOUD-DEVELOPER · Question #376
PROFESSIONAL-CLOUD-DEVELOPER Question #376: Real Exam Question with Answer & Explanation
The correct answer is C: Specify the cached image by adding the --cache-from argument in your build config file with the. Using the --cache-from argument enables Docker layer caching by specifying a previous image as a cache source. This allows Cloud Build to reuse layers from a previously built image, significantly reducing build time, especially when layers have not changed between builds. This ap
Question
You are deploying a containerized application to GKE. You have set up a build pipeline by using Cloud Build that builds a Java application and pushes the application container image to Artifact Registry. Your build pipeline executes multiple sequential steps that reference Docker container images with the same layers. You notice that the Cloud Build pipeline runs are taking longer than expected to complete. How should you optimize the Docker image build process?
Options
- AAdd the --squash parameter to the Docker build steps to combine newly built layers into a single
- BConfigure Cloud Build to use a private pool in your VPC for pipeline executions.
- CSpecify the cached image by adding the --cache-from argument in your build config file with the
- DStore container artifacts on Cloud Storage. Configure Cloud CDN on the Cloud Storage bucket to
Explanation
Using the --cache-from argument enables Docker layer caching by specifying a previous image as a cache source. This allows Cloud Build to reuse layers from a previously built image, significantly reducing build time, especially when layers have not changed between builds. This approach is effective in optimizing Docker image builds and is a recommended best practice for reducing build times in Cloud Build. - The --squash parameter is no longer supported in Docker and does not directly improve build - Using private pools in Cloud Build or Cloud CDN for container artifacts does not directly address build efficiency and caching in Docker builds.
Topics
Community Discussion
No community discussion yet for this question.