Docker & Containers (50 Qs)•Part 3: Advanced Internals, Scale & Production Security (Senior / Lead)
Rootless Docker: Running the Daemon and Containers as a Non-Privileged User.
senior LevelMost AskedSecurity & AuthDocker & Containers
In Simple Words:
Standard Docker requires the dockerd daemon to run as host root (root:root). Any access to /var/run/docker.sock is equivalent to root access on the host.
Rootless Docker runs both dockerd and containers inside a non-root user namespace without root privileges.
- Uses
newuidmapandnewgidmapto allocate UID/GID ranges. - Uses
slirp4netnsorrootlesskitfor user-mode networking without requiring root iptables access. - Even if a complete zero-day container escape occurs, the attacker lands on the host as a standard, unprivileged user with zero ability to compromise the host kernel or access host disks.