A monitoring agent
The socket mount and --privileged together are root on the host with extra steps
docker run -d --name agent -v /var/run/docker.sock:/var/run/docker.sock --privileged myagent:1
Understand a command somebody handed you before you run it. Four things in particular give a container effective control of the host, and none of them looks alarming.
Or drop a file anywhere on this panel. Nothing is uploaded: the analysis runs in this tab.
The answer appears here
Paste on the left and press Explain. Nothing leaves this tab.
Nothing else to flag.
No formatting problems, and nothing the rules object to. Worth remembering what that covers: this reads the file you pasted, not the account or cluster it will be applied to.
No finding matches that filter.
Real input you can load into the tool above. Each one shows a different thing going wrong, because that is what the tool is for.
The socket mount and --privileged together are root on the host with extra steps
docker run -d --name agent -v /var/run/docker.sock:/var/run/docker.sock --privileged myagent:1
-p stops doing anything, and loopback-only services become reachable
docker run -d --network host --name proxy nginx
Every flag explained, and nothing that hands over the host
docker run -d --name web -p 8080:80 -v /srv:/data nginx:alpine
These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.
It is a socket, not a file. Read-only does not stop a write, and a write is an API call that can start a privileged container.
Instead:Use a socket proxy that allows only the specific API calls needed.
It grants every capability and disables the security profiles, when the problem is usually one capability or one device.
Instead:Find the specific need with --cap-add or --device, and start from --cap-drop=ALL.
Everything after the image is passed to the container's process, so the flag never reaches Docker and appears to be ignored.
Instead:Put every docker flag before the image name.
--privileged, --pid=host, --network host and a mount of the Docker socket all remove the boundary the container was supposed to provide.
Anything that can talk to it can start a container with --privileged and the host's filesystem mounted, so the isolation is decorative. Adding :ro changes nothing, because the API is a socket rather than a file and read-only does not stop a write to it.
Plus device access and no seccomp or AppArmor profile. A process inside can load kernel modules and mount the host filesystem. It is almost always a blunt fix for one missing capability, and finding out which is worth an afternoon.
The container sees and can signal every process on the machine, and can read their /proc entries, which include environment variables and therefore other services' credentials.
-p stops doing anything, every port the process opens is open on the host, and it can reach services bound to 127.0.0.1 that were meant to be local only.
It permits mount, and mount permits reaching the host filesystem. NET_ADMIN and SYS_PTRACE are also far broader than their names suggest. Dropping everything with --cap-drop=ALL and adding back what is needed is the shape to aim for.
Not to Docker. A flag placed after the image name is passed straight through to the process, which is the commonest reason a flag appears to be ignored.