A container started with --privileged gets every capability and access to all host devices. It is the first thing I’d look for when taking over a box someone else set up.
This prints one line per running container:
docker ps -q | xargs docker inspect -f '{{.Name}} privileged={{.HostConfig.Privileged}}'
Every container marked privileged=true deserves a reason. Some tools really need it, like a few hardware monitoring or VPN images, but often it was copied from a forum post to make an error go away.
The same inspect output shows other risky settings. I’d add these to the template:
docker ps -q | xargs docker inspect -f '{{.Name}} caps={{.HostConfig.CapAdd}} pid={{.HostConfig.PidMode}} net={{.HostConfig.NetworkMode}}'
Added capabilities such as SYS_ADMIN, pid=host and net=host each give a container a bigger piece of the host. Fixing it means removing the flag and adding back only the one capability or device the container needs, with --cap-add or --device.
This only covers running containers. Stopped ones that start again at boot are just as relevant, so add -a to docker ps for the full picture. And bind mounts of / or of the Docker socket give root access too, without the privileged flag.
Further reading: docker container inspect reference, Docker run reference: runtime privilege