Image Digest and Content Addressing
You'll learn how containers use cryptographic hashes to guarantee you're running the exact image you expect, every time.
What Is an Image Digest?
An image digest is a unique cryptographic fingerprint (usually a SHA-256 hash) that represents the exact content of a container image. Think of it like a barcode that changes if even a single byte in the image is modified—it's mathematically derived from all the image layers and metadata you learned about previously.
When you reference an image by tag (like nginx:latest), that tag can move—someone could push a new version under the same tag tomorrow. But an image digest is immutable. It always points to the exact same image content, forever.
Content Addressing in Action
Instead of using human-friendly tags, you can pull or run an image using its digest:
nginx@sha256:abc123def456...
This content-addressed approach means the image content itself determines its identifier. If the content changes by even one bit, you get a completely different digest. This provides:
- Verification: You can confirm no one tampered with the image during transport
- Reproducibility: Deployments always use the exact same image version
- Security: You know precisely what code you're running in production
Why This Matters
Tags are convenient for humans, but digests provide cryptographic certainty. When you push an image to a registry, it calculates the digest from all the layer hashes (which you learned about earlier). When you pull it later, the digest is recalculated and compared—if they don't match, the image was corrupted or altered.
Key Takeaway: Image digests are cryptographic hashes that uniquely and immutably identify container image content, enabling verifiable, reproducible deployments independent of mutable tags.