Google Cloud Professional Cloud Developer — Question 337

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?

Answer options

Correct answer: C

Explanation

The correct answer is C because using the --cache-from argument allows the build process to leverage existing image layers, speeding up the build time significantly. Option A, while beneficial for reducing image size, does not directly address the speed of the build process. Option B may improve resource allocation but does not inherently optimize the image build time. Option D shifts the artifact storage but does not enhance the build efficiency itself.