Skip to main content
RunBook Academy

← All checklists in Docker & Containers

Before deploymentSecurity

Checklist: Container security review

16 items ·7 critical ·8 warn ·1 info

How to use

Run this checklist on every container image before it ships to production. Items in critical severity must be addressed; the build should fail CI if any are missing.

For Compose-based stacks, run the checks against the resolved container state after docker compose up.

Why these checks

The critical items address the most likely paths to a container-compromise incident:

  • Non-root, capabilities dropped, no-new-privileges, no socket mount. Limits the blast radius of a vulnerability inside the container.
  • Pinned digest, signed image, clean scan. Ensures the image is what we say it is and has no known critical CVEs.
  • No secrets in env. Stops credential leakage through docker inspect, ps, and child processes.

The warn items are best-practice discipline: not blocking, but the production baseline assumes them.

Critical7 items

  1. docker run --rm IMAGE id
  2. docker inspect CONTAINER --format "{{json .HostConfig.CapDrop}}" && docker inspect CONTAINER --format "{{json .HostConfig.CapAdd}}"
  3. docker inspect CONTAINER --format "{{json .HostConfig.SecurityOpt}}"
  4. docker inspect CONTAINER --format "{{.HostConfig.Privileged}}"
  5. docker inspect CONTAINER --format "{{json .Mounts}}" | grep docker.sock || echo OK
  6. trivy image --severity HIGH,CRITICAL --exit-code 1 IMAGE
  7. docker inspect CONTAINER --format "{{json .Config.Env}}" | grep -i password || echo OK

Warning8 items

  1. docker inspect CONTAINER --format "{{.HostConfig.ReadonlyRootfs}}"
  2. grep -E "image:.*@sha256:" compose.yml
  3. docker inspect CONTAINER --format "{{json .NetworkSettings.Networks}}"
  4. docker inspect CONTAINER --format "{{json .HostConfig.Memory}}"
  5. docker inspect CONTAINER --format "{{.HostConfig.PidsLimit}}"

Info1 item