Interview Prep/Docker/Security and scanning

How do you prevent a container from gaining privileges via setuid binaries?

IntermediateScenarioSecurity and scanning
Answer

Situation read → setuid binaries like su or ping can be abused.

What I'd do → --security-opt no-new-privileges:true and strip setuid bits in the image: RUN find / -perm /6000 -type f -exec chmod a-s {} + || true. Drop capabilities.

Why → no-new-privileges sets the kernel flag so execve cannot raise privileges.

Interview tip → In Kubernetes: allowPrivilegeEscalation: false.

All Docker questions Roadmap: Docker & containers

More on Security and scanning