Which `docker run` flags make up a hardened runtime baseline?
BeginnerProductionImage Security & Hardening
Answer
docker run -d \
--user 10001:10001 \
--read-only --tmpfs /tmp \
--cap-drop ALL \
--security-opt no-new-privileges:true \
--pids-limit 200 --memory 512m \
app:1.4.2
Add back only specific capabilities needed (--cap-add NET_BIND_SERVICE if binding below 1024).
More on Image Security & Hardening
Why should containers not run as root, and how do you enforce it?BeginnerWhat is a distroless image and what are the trade-offs?BeginnerHow do you scan an image with Trivy and fail a CI build on serious findings?BeginnerHow do you manage Trivy false positives and accepted risks?IntermediateWhat does `no-new-privileges` protect against?BeginnerHow should secrets be handled in container workloads?Beginner