Skip to content

Lesson 8 of 9 · 27m

Image Hygiene, Provenance, and Supply-Chain Controls

Pin inputs, scan usefully, sign and verify images, generate provenance, and avoid registry practices that turn deployment into supply-chain roulette.

Container images are software distribution artifacts. If you would not curl a random binary into production, you should not deploy a mutable image reference whose provenance nobody can explain. Supply-chain control sounds ceremonial until the day a base image updates, a transitive package changes, or a registry tag is overwritten and nobody can reconstruct what actually ran.

Tags are names, digests are identity

A tag can move. A digest identifies immutable image content:

docker pull alpine:3.20
docker image inspect alpine:3.20 --format '{{index .RepoDigests 0}}'

Use tags for humans and digests for deployment-critical pinning where your platform supports it:

alpine:3.20                                           human-friendly, mutable
alpine:3.20.3                                         narrower but still tag-based
alpine@sha256:1c4eef...                              immutable content reference

Do not pin everything blindly without update process. Pinning freezes both features and vulnerabilities. The mature pattern is pinned inputs plus controlled, automated update and verification.

Scanning is triage, not truth

Scanners match package manifests and metadata against vulnerability databases. They miss embedded binaries, application-level dependencies, misconfiguration, runtime exposure, and malicious behavior. They also shout about vulnerabilities in code paths you never execute.

trivy image --severity HIGH,CRITICAL registry.internal/app:2.4.1
grype registry.internal/app:2.4.1 --output table

Use scan output to answer operational questions: what package, which layer introduced it, is it fixed in an available version, is the affected code reachable, and who owns remediation? "Zero CVEs" is not a security architecture.

Signatures and provenance answer different questions

A signature says a trusted key attested to a specific image digest. Provenance says how the artifact was built — source revision, builder, materials, and invocation. SBOMs describe components. Together they help you avoid deploying anonymous artifacts.

cosign sign --yes registry.internal/app@sha256:1c4eef...
cosign verify --key cosign.pub registry.internal/app@sha256:1c4eef...
cosign verify-attestation --key cosign.pub   registry.internal/app@sha256:1c4eef...

For Docker BuildKit, provenance and SBOM attestations can be generated during build:

docker buildx build   --provenance=true --sbom=true   -t registry.internal/app:2.4.1 --push .

Registry hygiene is part of the boundary

A private registry needs authentication, authorization, immutability decisions, retention policy, vulnerability scanning, replication, backup, and audit logging. The most common mistake is treating it as a file server with OAuth bolted on. Ask who can push latest, who can overwrite tags, whether production pulls mutable tags, and whether build runners share credentials broadly.

A sane division is:

base images       curated, mirrored, scanned, updated deliberately
candidate tags    built by CI from immutable commits
release digests   promoted after verification
deployments       pinned to digest or verified release identity

Dependency files are part of the image contract

package-lock.json, go.sum, requirements.txt hashes, lockfiles, checksums, and vendored dependencies are not bureaucratic debris. They determine whether two builds produce the same software. A Dockerfile can pin the base perfectly and still download different application dependencies every time if the project ignores lockfiles.

Field notes

  • latest is only a tag. It means nothing about freshness, stability, or release approval.
  • Docker content trust, registry immutable tags, cosign verification, and admission policy solve different parts of the problem; know which one you actually enabled.
  • SBOM quality depends on build capture. A scanner-generated inventory after the fact may miss copied artifacts.
  • Vulnerability severity is not exploitability. Reachability, network exposure, privileges, and compensating controls decide priority.
  • Keep enough artifacts and attestations to reconstruct incidents, but do not retain secrets in layer history for archaeology's sake.

Was this lesson helpful?

Sign in to rate