The check reads exactly one value: the octal mode of the /var/lib/docker/volumes directory itself, taken with stat -c '%a' run through as_root. Four modes pass and no others - 700, 701, 710 and 711. 701 is the mode Docker sets, and none of the other three gives other local accounts more than 701 does. Anything else, 755 and 777 included, is a WARN quoting the mode it found, and an empty result from stat is a SKIP rather than a pass. Nothing below the volumes root is examined; the per-volume _data modes belong to the World-Writable Volumes check.
Needs root or sudo and an existing /var/lib/docker/volumes; otherwise SKIP. It looks at exactly one directory - the volumes root itself - and accepts four modes: 700, 701, 710, 711. Anything else, including 755, is a WARN. Per-volume modes are deliberately out of scope here (the World-Writable Volumes check covers them), so the two checks do not report the same misconfiguration twice. The Docker daemon sets this directory back to 701 every time it starts, so a WARN means the mode was changed after the daemon last started, almost always by hand or by a script.
| Result | When | What it means |
|---|---|---|
| SKIP | No root / directory absent / stat failed | Nothing was verified. The mode was never read, so it could be anything. |
| PASS | Standard Docker mode | The volumes root has Docker's own 701 or one of the three modes that are no looser, so an unprivileged local account cannot list the volumes in it. |
| WARN | Anything looser (e.g. 755, 777) | Someone has widened the volumes root since the daemon last started, usually with a recursive chmod that loosened /var/lib/docker as well. Any local account can then list every volume and reach its data, limited only by each volume's own mode. |
Docker creates /var/lib/docker with mode 0710 and /var/lib/docker/volumes with 0701, both owned by root. The parent keeps other local accounts out entirely; the volumes root is the second layer, letting a process traverse to a volume whose name it already knows without letting anyone list the volumes. Each volume's _data directory is created 0755, so once both layers are loosened, any local account can read every volume's database files, uploads and secrets. CIS Docker 1.2 host configuration / 3.x file permissions.
- Operators who ran
chmod -R 755 /var/lib/dockerto debug, or backup tools that reset modes on restore. - The daemon resets the mode to
701when it starts, so a WARN that disappears after a reboot or a Docker restart was real until then. Find what changed it, or it will come back. - Custom
data-root→ SKIP; adapt the path.
Restore the volumes directory
701is the mode Docker itself sets.700and710also pass, but the daemon sets701again at its next start.sh sudo chmod 701 /var/lib/docker/volumessudo chown root:root /var/lib/docker/volumesRestarting Docker (
sudo systemctl restart docker) also restores701, but it stops every container unlesslive-restoreis on, so thechmodis the fix that needs no downtime.Check the parent directory
A recursive
chmodthat loosened the volumes root usually loosened/var/lib/dockertoo, and that directory is what keeps local accounts out of every volume.sh sudo stat -c '%a %U:%G' /var/lib/docker# expected: 710 root:root (711 on a host using userns-remap)sudo chmod 710 /var/lib/dockerFind what loosened it
Search your cron jobs, deploy scripts and configuration management for a recursive
chmodagainst/var/lib/docker, and remove it.sh sudo grep -rnE 'chmod +-R.*/var/lib/docker' /etc/cron* /etc/ansible /usr/local/bin /opt 2>/dev/null
sudo stat -c '%a %U:%G %n' /var/lib/docker/volumes# expected: 701 (or 700/710/711) root:root# Confirm an unprivileged account cannot list or traverse it:sudo -u nobody ls /var/lib/docker/volumes # expected: Permission deniedsudo -u nobody ls /var/lib/docker/volumes/<name>/_data # expected: Permission denied- There is no unprivileged fallback, and membership of the
dockergroup does not help: it reaches the daemon, not this directory. Run the audit as root or give the audit account sudo. - Docker keeps its data somewhere else.
docker info --format '{{.DockerRootDir}}'shows where. A customdata-rootindaemon.json, a rootless daemon (volumes under~/.local/share/docker) anduserns-remap(volumes under/var/lib/docker/<uid>.<gid>/volumes) all land here. Run thestatabove against the real path. - The directory exists but
statreturned nothing, which usually means a permission or filesystem problem even under sudo. Run the command by hand to see the error. - Someone ran a recursive
chmodover/var/lib/docker, which is the usual cause. Restore it withsudo chmod 701 /var/lib/docker/volumes. That mode lets a process traverse into a volume path it already knows but not list the directory;700is stricter and also accepted. Check/var/lib/dockeritself as well, as in the second step above. - A configuration-management run or a recursive
chmodin a maintenance script. Search your automation forchmod -Ragainst/var/lib/docker. If you set700or710and now see701, that is Docker itself: the daemon sets the directory to701when it starts, which still passes. - This check looks only at the root directory. The per-volume modes are the World-Writable Volumes check, and neither examines the files inside a volume.
