Docker Security Best Practices: Images, Runtime, and Supply Chain
Harden container images and runtime. Image scanning, minimal base, and supply chain security.
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.
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
GitHub Copilot CLI Sandboxing Is GA: What Actually Changed
GitHub made local sandboxing generally available for Copilot CLI on October 7, so the default now restricts the agent instead of trusting it.
The Tensorlake npm Compromise Targeted Your AI Tool Configs
A compromised npm release went after cloud credentials as expected, and local AI coding-assistant config files, which most teams never treated as secrets.
GitLab's New Rate Limits: What to Fix Before Oct 19
GitLab is capping unauthenticated API calls at 60 an hour starting October 19, and the preview windows land before most teams will have noticed.
You might have missed
Evergreen posts worth revisiting.