How do you handle Linux capabilities for a service binding to port 80?
IntermediateProductionImage Security & Hardening
Answer
Best: bind to a high port (8080) in the container and map externally. Otherwise drop all and add back only NET_BIND_SERVICE, or set net.ipv4.ip_unprivileged_port_start=0 for the container namespace:
docker run --sysctl net.ipv4.ip_unprivileged_port_start=80 --user 10001 app
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