# Can a Container Run as Root Without Being Root on the Host?

DevFeed: [Can a Container Run as Root Without Being Root on the Host?](<https://devfeed.tech/articles/can-a-container-run-as-root-without-being-root-on-the-host-97873.md>)

Original publisher: [Read original article](<https://kodekloud.com/blog/can-a-container-run-as-root-without-being-root-on-the-host/>)

Author: Pramodh Kumar M

Published: 2026-10-23T18:00:00Z

Content type: article

Language: en

Sources: [KodeKloud](<https://devfeed.tech/sources/kubernetes-kodekloud-blog-devops-cloud-kubernetes-ai-tutorials-more.md>)

Topics: [container escape](<https://devfeed.tech/topics/container-escape.md>), [least privilege](<https://devfeed.tech/topics/least-privilege.md>)

Tags: [cks](<https://devfeed.tech/tags/cks.md>), [container](<https://devfeed.tech/tags/container.md>), [container-security](<https://devfeed.tech/tags/container-security.md>), [devsecops](<https://devfeed.tech/tags/devsecops.md>), [docker](<https://devfeed.tech/tags/docker.md>), [kubernetes](<https://devfeed.tech/tags/kubernetes.md>), [linux](<https://devfeed.tech/tags/linux.md>), [root](<https://devfeed.tech/tags/root.md>), [rootless-containers](<https://devfeed.tech/tags/rootless-containers.md>), [security](<https://devfeed.tech/tags/security.md>), [user-namespaces](<https://devfeed.tech/tags/user-namespaces.md>)

## AI overview

User namespaces let a container remain root inside while mapping its ID 0 to an unprivileged host ID. In the described Docker lab, default container root could read a host root-only file and created host-owned files; after enabling `"userns-remap": "default"`, it could do neither, and the host saw the process as ID 100000. Docker remaps containers to a shared ID range while its daemon remains root; rootless Docker also runs the daemon as a normal user. Kubernetes pods can use `hostUsers: false` for separate ID ranges, subject to version, kernel, and runtime requirements. Remapping has tradeoffs: host networking, shared host process namespaces, and privileged containers are incompatible, and bind-mount ownership needs planning. The text recommends retaining non-root application users as another security layer.

## Source excerpt

Root inside a container is usually the same root that owns your host. Watch one setting change that, as the same container loses access to a root only file.