Free security runbook · containers

Container CVE response: rebuild without taking the service down

A scanner flags a base-image CVE. The tag, the digest on the host and the digest in the registry can all differ. The response is a rebuild and a rolling replacement, with a rollback that does not reopen the hole.

Digest, not tag

latest can point at a vulnerable layer. Compare the running image ID with the registry digest.

Rebuild the base

Patching inside a running container is not a fix; rebuild from a patched base and redeploy.

Rolling replacement

Surge or drain, health checks, and a real readiness probe; do not kill all replicas at once.

Rollback guard

Keep the previous digest but mark it as vulnerable; roll back only to a patched build.

Detect

What is actually running?

CommandWhat it shows
docker ps --format '{{.Names}} {{.Image}} {{.ImageID}}'Running containers and the image ID in use.
docker image inspect <id> --format '{{.RepoDigests}}'Registry digest, not the local tag.
trivy image <ref> / docker scout cves <ref>CVEs in the exact image you are about to deploy.
kubectl get pods -o jsonpath='{..imageID}'Digest on the node, which can differ from the manifest.
Rollout

Order of operations

1. Freeze the tag

Pin by digest in the deployment; a mutable tag defeats the rebuild.

2. Rebuild and scan

The new digest must be scanned, not the old one with a new tag.

3. Canary

One replica, real traffic, watch 5xx and latency before the surge.

4. Rollback plan

Previous patched digest, not the vulnerable one; test the rollback path.

Keep going

This page is free. The paid runbooks cover the operational failures around it, with detection commands, five failure modes and a migration checklist.