LOGBOOK

HELP

Quiz Entry - updated: 2026.11.30

Why is adding a user to the docker group effectively the same as giving them root?

Group members get full access to the Docker daemon, which runs as root, and can ask it to start a container that mounts the host's / and gives them a root shell on it.

sudo usermod -aG docker labadmin lets labadmin run docker without sudo, because the group may open the daemon's socket /var/run/docker.sock. But the daemon runs as root and will do whatever it is asked, for example:

docker run -it -v /:/host alpine chroot /host sh

This starts a container whose root user has the host's entire filesystem mounted, and leaves the user in a root shell on the host's files: they can read /etc/shadow, add themselves to sudoers or install a backdoor. No password, no sudo log entry.

Consequences:

  • Treat docker group membership like sudo rights and grant it only to trusted administrators.
  • The group change only applies after logging out and in again (the session's group list is fixed at login).
  • Alternatives that remove the problem: rootless Docker or Podman's rootless mode, where the container engine runs with the user's own privileges.

Privilege escalation via the docker group: user, socket, root daemon, container mounting the host root, root shell

* Group membership, socket access, root daemon, host root shell. *

Go deeper:

From Quiz: ISLAB / Docker Introduction | Updated: Nov 30, 2026