intermediateContainer Security: Non-Root, Secrets, Image Scanning & Distroless

What is the difference between running as non-root inside a container and using rootless Docker?

Setting USER in a Dockerfile makes the containerized process run as a non-root UID inside the container's own view, which is good practice but doesn't change how the Docker daemon itself runs on the host. Rootless Docker runs the entire Docker daemon as an unprivileged user, so there is no root daemon process on the host at all — a more thorough mitigation, since it removes daemon-level root risk, not just in-container process risk.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to How would you enforce security scanning as part of a CI/CD pipeline?← Back to all Docker questions