Checks / Docker and containers

A container runs privileged

Check
docker.privileged
Severity
high
Runs
on the server, in the daily run of the agent
Looks at
HostConfig.Privileged is true
Updated 26 Nov 2026

What the check looks at

HostConfig.Privileged of every running container (docker inspect). The check fails for each container where it is true, with the container name as the subject.

Risk

--privileged, or privileged: true in a Compose file, removes most of the isolation between container and host. In a test on Docker 29.9 with kernel 6.12, a privileged container had all 41 capabilities of the kernel instead of 14, its seccomp filter was off, and /dev held 161 entries instead of 15, the disks of the host among them. The Docker documentation adds that the option "reconfigures AppArmor or SELinux to allow the container nearly all the same access to the host".

With the disks and CAP_SYS_ADMIN, a root process in the container can mount the file system of the host and change any file, so a bug in the application becomes a way into the host.

How to fix it

Find out what the container needs. Common cases have a narrower option:

The container needs Narrower option
a device such as /dev/net/tun, a USB device or /dev/dri --device /dev/net/tun (Compose: devices: ["/dev/net/tun:/dev/net/tun"])
network configuration inside the container, for a VPN --cap-add NET_ADMIN
FUSE --cap-add SYS_ADMIN --device /dev/fuse

Remove privileged: true (or --privileged), add the narrower options, and recreate the container:

docker compose up -d --force-recreate <service>

If the program fails, its error message usually names the missing device or the denied operation. Add that one item and try again.

Docker in Docker (docker:dind) needs --privileged. Run such CI builds on a runner host of their own, away from servers with production data.

How to check the fix

docker ps -q | xargs -r docker inspect --format '{{.Name}} privileged={{.HostConfig.Privileged}}' \
  | grep 'privileged=true'

The output must be empty.

When a warning is fine

Some software manages the host and documents that it needs --privileged: hardware monitoring, some storage and network tools, Docker in Docker on a separate CI host. If you trust the image and run it on purpose, accept the result on the dashboard and keep the image pinned and updated. A web application or a database never needs it.

An accepted result stays out of the digest and the counts until it changes.

Sources