Skip to main content
Docker Security Best Practices: Images, Runtime, and Supply Chain

Docker Security Best Practices: Images, Runtime, and Supply Chain

KU
· Founder & Chief Editor
• 1 min read•

Last reviewed . Tool versions and defaults may have changed since, so check the commands against current docs.

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.
Dockerfile
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.

React
Share this post
Cite this article
Plain text

Kiril Urbonas (2025). Docker Security Best Practices: Images, Runtime, and Supply Chain. DevOpsNess. https://www.devopsness.com/blog/docker-security-best-practices-images-runtime-and-supply-chain

Markdown

[Docker Security Best Practices: Images, Runtime, and Supply Chain](https://www.devopsness.com/blog/docker-security-best-practices-images-runtime-and-supply-chain) (Kiril Urbonas, DevOpsNess, 2025-06-11)

KU

Kiril Urbonas

Founder & Chief Editor

611 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.