Reduce capabilities for an nginx container that binds port 80 as non-root.
IntermediateScenarioSecurity and scanning
Answer
Situation read → nginx master needs a few caps for root start; unprivileged variant avoids them.
What I'd do → Use nginxinc/nginx-unprivileged listening on 8080, then --cap-drop ALL. If binding low ports is mandatory, --cap-add NET_BIND_SERVICE or --sysctl net.ipv4.ip_unprivileged_port_start=80.
Why → Minimal capabilities with no root user reduce risk.
Interview tip → Publish -p 80:8080 on the host side instead.
More on Security and scanning
A scan reports 300 CVEs in your base image. How do you triage?IntermediateAdd vulnerability scanning to CI so critical findings block the merge.BeginnerWhy is mounting `/var/run/docker.sock` into a container dangerous?IntermediateA developer asks for `--privileged`. What do you do?IntermediateHarden a container run command for a stateless web API.IntermediateA pentester got root inside a container. How bad is it?Advanced