Safeguard
Security Guides•

Is it safe to add a user to the docker group?

No. Docker's docs say the docker group grants root level privileges. See what that means, the group password myth and safer options for shared machines.

Safeguard Security Team
4 min read

Not in the sense most people hope. Docker's installation guide warns that membership in the docker group grants root level privileges. Treat adding a user as granting them root on that machine. On shared hosts and CI runners, consider rootless mode or a virtual machine instead.

Why the group equals root

The Docker daemon always runs as root unless you use rootless mode. It listens on a Unix socket that members of the docker group can use. Anyone who can talk to the daemon can ask it to start containers with whatever settings they choose.

Docker's security page spells out the mechanism. Docker allows you to share a directory between the host and a container without limiting the container's access rights. You can start a container where a directory is the host's root directory, and the container can then alter the host filesystem. The page concludes that only trusted users should be allowed to control the Docker daemon.

A single command can mount the host's root directory and give the user a root shell over it. That is why the post install guide's warning is blunt.

The group password idea

The post install guide describes an alternative for single user workstations: keep your user out of the group, set a group password and use a command to start a Docker enabled shell on demand. The same guide then qualifies it. A group password reduces ambient access to the socket, but does not reduce the root level privileges granted after access is authorized. Group passwords are shared secrets and give no per user accountability. The guide says the method is not a security boundary against malicious code running as your user, because such code can modify shell configuration or scripts you later use and gain access after you authenticate.

It adds that for stronger isolation you should use rootless mode or run Docker in a virtual machine.

Options compared

OptionWhat it givesRemaining risk
docker groupConvenience, no sudoMembers have root level privileges
sudo for each commandPrompts and logs per useStill root once authorized
Group password shellLess ambient accessNot a boundary against code running as you
Rootless modeDaemon and containers without rootSetup prerequisites and some feature limits
Docker inside a VMSeparates the daemon from the hostA VM to maintain

What this means for teams

  1. Developer laptops. Membership is common and mostly a convenience. Accept the risk knowingly and keep the laptop patched.
  2. Shared servers. Do not add untrusted users. Give each person a rootless setup or a VM.
  3. CI runners. A job that can reach the daemon controls the runner host. Isolate runners and prefer daemonless or rootless builds. See Docker in Docker, socket binding and daemonless builds.
  4. Containers that need Docker access. Mounting the socket has the same effect, as covered in why the socket mount is root.

A quick audit

  1. List the members of the docker group on each host.
  2. Remove anyone who does not need it today.
  3. Check whether any service account is in the group.
  4. Move shared or untrusted use cases to rootless or a VM.

Rootless setup steps are in rootless Docker prerequisites.

Safeguard can inventory the assets and dependencies on your build hosts, with a free scan at gold.safeguard.sh/scan.

Quick check

Is a user in the docker group the same as a sudoer?

For practical purposes the privileges are equivalent, because the daemon runs as root and the user can direct it to access the host filesystem.

Does rootless mode remove the problem?

It removes the root daemon, so a user controlling it gets only their own privileges. It has its own prerequisites and limits.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.