Container Image Verification
What you'll learn: How to cryptographically verify that container images are authentic and haven't been tampered with before deploying them.
The Problem
When you pull a container image like nginx:latest, how do you know it's the legitimate image from the official maintainer and not a malicious copy? Just like verifying package integrity with checksums and signatures, container images need cryptographic verification to prevent supply chain attacks.
Core Verification Technologies
Docker Content Trust (DCT)
Docker Content Trust uses Notary, a framework that implements The Update Framework (TUF), to sign and verify images. When enabled, Docker will only pull, run, or build with trusted images that have been signed.
Think of it like a wax seal on a letter: the publisher signs the image with their private key, and you verify it with their public key to ensure it came from them and wasn't altered.
cosign
cosign is a newer tool from the Sigstore project that simplifies container signing. It stores signatures either alongside images in the registry or in a transparency log, making verification straightforward and auditable.
How Verification Works
- Signing: The image publisher signs the image digest (a SHA256 hash) with their private key
- Publishing: The signature is stored with metadata pointing to the image
- Verification: Before running the image, your system checks the signature against the publisher's public key
- Trust: Only if the signature is valid and matches a trusted key does deployment proceed
This prevents attackers from injecting malicious images or tampering with legitimate ones—even if they compromise the registry itself.
Key Takeaway: Container image verification uses cryptographic signatures (via Docker Content Trust/Notary or cosign) to ensure images are authentic and unmodified, protecting your deployment pipeline from supply chain tampering.