Docker Security Best Practices: Images, Runtime, and Supply Chain
Harden container images and runtime. Image scanning, minimal base, and supply chain security.
Key takeaways
- Harden container images and runtime.
- Image scanning, minimal base, and supply chain security.
On this page
Docker Security Best Practices: Images, Runtime, and Supply Chain#
Containers are a big attack surface. These practices reduce risk without slowing delivery.
1. Minimal and Updated Base Images#
- Prefer distroless or Alpine; avoid full OS images when possible.
- Pin tags by digest and rebuild regularly for CVEs.
FROM golang:1.21-alpine AS builder
# build...
FROM gcr.io/distroless/static-debian12
COPY --from=builder /app /app
ENTRYPOINT ["/app"]
2. Non-Root and Read-Only#
- Run as non-root (USER in Dockerfile; runAsNonRoot in Kubernetes).
- Use read-only root filesystem where possible; mount writable dirs only when needed.
3. Image Scanning#
- Scan in CI (e.g. Trivy, Snyk) and block critical/high CVEs.
- Scan at runtime or in registry and alert on new findings.
4. Supply Chain#
- Sign images (Cosign, Notary); verify in admission control.
- Prefer private registries and pin base image digests.
Making these standard for every image and deployment significantly improves your security posture.
Get the DevOps Troubleshooting Cheat Sheet
Subscribe and get our free one-page reference for the errors that eat an afternoon — CrashLoopBackOff, OOMKilled, Terraform state locks, and more — plus new guides as we publish them.
Best Practices: AWS Cost Control with Tagging and Budgets
AWS bill grew 40% YoY for two years before we got serious. Tagging, scoped budgets, and a weekly review meeting did 80% of the work.
Best Practices: Kernel and Package Patch Management
We had four different patch cadences across our fleet and routinely missed CVEs by weeks. The unified workflow that finally caught up.
More from DevOps
Explore more articles in this category
Best Kubernetes IDE and GUI Tools in 2026
kubectl is fine until you're juggling five namespaces across three clusters. These are the tools that make that manageable, compared.
Chef vs Puppet vs Ansible: Configuration Management in 2026
One is agentless and Python-based, the other two run a persistent agent and a domain-specific language. The architecture difference matters more than the syntax.
PagerDuty vs Opsgenie: Choosing an Incident Alerting Tool
Both page the right person at 3am and both integrate with everything. The real differences show up in pricing structure, workflow depth, and who already owns the ecosystem around you.
You might have missed
Evergreen posts worth revisiting.