Interview Prep/Docker/Security and scanning

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.

All Docker questions Roadmap: Docker & containers

More on Security and scanning