Interview Prep/Docker/Multi-stage builds, cache, tags and registries

You want to verify that the image a node pulled is the one CI built and signed.

AdvancedScenarioMulti-stage builds, cache, tags and registries
Answer

Situation read → Tag-only trust can be hijacked by a registry compromise or accidental overwrite.

What I'd do →

  1. Sign in CI: cosign sign --yes reg.example.com/app@sha256:... (keyless via OIDC).
  2. Attach SBOM and provenance: docker buildx build --sbom=true --provenance=mode=max.
  3. Enforce at admission: Kyverno or Sigstore policy-controller verifying the signature identity and issuer.
  4. Locally verify: cosign verify --certificate-identity-regexp ... --certificate-oidc-issuer https://token.actions.githubusercontent.com image@sha256:....

Why → Verifies who built it and that the content has not changed.

Interview tip → Sign digests, not tags.

All Docker questions Roadmap: Docker & containers

More on Multi-stage builds, cache, tags and registries