Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
Google Cloud Certified Professional Cloud Developer · Google Cloud
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
The best answer is C. Use the digest of the Docker image. Here's why: Docker Image Digest: A digest is a unique identifier for a specific Docker image. It's a cryptographic hash of the image's contents, ensuring that you're always deploying the exact same image across environments.
Let's break down why the other options are less ideal: A. Use the latest Docker image tag: The latest tag is mutable. If you push a new image with the latest tag, it will overwrite the previous latest image. This can lead to inconsistencies across environments if different environments pull the latest tag at different times. B. Use a unique Docker image name: While using unique names can help with organization, it doesn't guarantee that you're deploying the same image across environments. You could accidentally push a different image with the same name, leading to inconsistencies. D. Use a semantic version Docker image tag: Semantic versioning is a good practice for managing software releases, but it doesn't guarantee that the image content is identical across environments. You could accidentally push a new image with the same semantic version but different content.
C. Use the digest of the Docker image. When promoting Docker images across different environments in a CI/CD pipeline, it's crucial to ensure that exactly the same image is deployed to each environment. The most reliable way to identify a Docker image is by using its digest. Here's why using the digest is the best approach: The digest is a SHA256 hash of the image's content and configuration, which uniquely identifies an image. If anything about the image changes, the digest changes. This means that if you deploy an image by its digest, you are guaranteed to deploy the exact same image in each environment. Using the digest is more reliable than using tags like 'latest' or semantic versioning. Tags can be moved to point to different images, but digests are immutable. Once an image is pushed to a registry, its digest can never change.