Interview Prep/Docker/Security and scanning

User namespaces: when would you enable `userns-remap`?

AdvancedScenarioSecurity and scanning
Answer

Situation read → You want container root to map to an unprivileged host UID without going fully rootless.

What I'd do → Set {"userns-remap": "default"} in daemon.json; Docker creates dockremap and uses /etc/subuid. Be aware: images and volumes get re-owned under a separate storage dir, and features like --privileged, host networking and some volume drivers are restricted.

Why → Root escape lands as a non-root UID on the host.

Interview tip → Rootless mode is the stronger alternative for new setups.

All Docker questions Roadmap: Docker & containers

More on Security and scanning