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 →
- Sign in CI:
cosign sign --yes reg.example.com/app@sha256:...(keyless via OIDC). - Attach SBOM and provenance:
docker buildx build --sbom=true --provenance=mode=max. - Enforce at admission: Kyverno or Sigstore policy-controller verifying the signature identity and issuer.
- 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.
More on Multi-stage builds, cache, tags and registries
Show a multi-stage Dockerfile for a Java Spring Boot app and explain what you gain.BeginnerCI rebuilds from scratch every run and takes 12 minutes. How do you bring it down?IntermediateYou tag every build `myapp:latest`. A rollback is requested. What happens?BeginnerHow do you promote an image from dev to prod registry without rebuilding?IntermediateDisk on the build server keeps filling up with images.BeginnerWhen do you use `--no-cache` and when is it a smell?Beginner