Skip to content

Using one safely

Pin by digest, enforce immutability, scan on push, sign with cosign, and prune old images.

Container registry best practices

  1. Pin by digest, not tag

    image:app@sha256:abc... is immutable. image:app:latest is a promise that breaks.

  2. Enforce immutability

    Harbor, ECR, GCR, ACR all support rejecting re-push. Enable it.

  3. Scan on push

    Trivy, Grype, Snyk. Fail the push on critical CVEs. Post-hoc scans find the damage too late.

  4. Sign with cosign

    cosign sign --key k8s://... <image>. Deploy verifies cosign verify. Unsigned images are trust-by-hope.

  5. Prune old images

    Keep last 20 per tag. A registry with 50,000 stale images costs real money.