How should secrets be handled in container workloads?
BeginnerProductionImage Security & Hardening
Answer
Never bake them into images, ENV, or ARG; they leak via docker history/inspect. At build time use BuildKit secret mounts. At runtime inject from a secret manager (AWS Secrets Manager, Vault, Kubernetes Secrets with KMS), as mounted files (/run/secrets/...) rather than env vars, since env vars leak in crash dumps, inspect, and child processes.
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?IntermediateWhich `docker run` flags make up a hardened runtime baseline?BeginnerWhat does `no-new-privileges` protect against?Beginner