Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
Docker security covers the daemon, the host, the images, and the runtime flags that decide how much isolation a container actually has—starting with never exposing the API.

What Is Docker Security?
Docker security is the set of decisions that determine how much isolation a container actually has, and who can ask for a container to be created in the first place. The second question is the more urgent one, because the Docker daemon traditionally runs as root and anyone able to talk to it can run anything on the host with full privileges.
Membership of the docker group on a Linux host is equivalent to root. A user in that group can start a container with the host filesystem mounted and read or modify anything, with no password prompt and no sudo entry in the logs. Treat group membership as administrative access and manage it accordingly.
Far worse is exposing the daemon over the network. The API on TCP port 2375 is unauthenticated by default, and internet-wide scanning for it is continuous. Campaigns associated with TeamTNT and similar crews have built their entire operation around finding exposed Docker and Kubernetes endpoints, deploying cryptomining containers, and harvesting cloud credentials from the host. If you must expose the API, use TLS with client certificate authentication on port 2376, restrict it at the firewall, and ask first whether an SSH-based context would do instead.
Rootless Docker runs the daemon and the containers as an unprivileged user, so a breakout lands as that user rather than as root. It has become production-viable, with limitations around certain networking features, privileged ports below 1024, and some storage drivers. Where rootless is impractical, user namespace remapping gives much of the benefit by mapping container root to an unprivileged host user.
Either way, the container should not run as root internally. Set USER in the image, and enforce it at runtime so that an image which ignores the convention cannot simply opt out.
--privileged grants nearly all capabilities and host device access. It is effectively root on the host.-v /var/run/docker.sock:/var/run/docker.sock hands the container control of the daemon, which is the same thing by a different route.--net=host, --pid=host, and --ipc=host each remove a namespace boundary.--cap-add=SYS_ADMIN is the capability most frequently abused in published escape techniques.--security-opt seccomp=unconfined removes the default system call filter, which blocks a large share of the kernel surface attacks rely on./, /etc, or /proc gives a container the keys to the host directly.Each of these appears in genuine tooling, which is precisely why they are the first thing an attacker looks for. The routes they open are covered in our entry on the container escape.
Run containers as a non-root user with --cap-drop=ALL and only the capabilities actually needed added back, a read-only root filesystem with writable tmpfs for scratch space, --security-opt no-new-privileges, the default seccomp and AppArmor or SELinux profiles enabled, and explicit memory and CPU limits so one container cannot starve the host. Put containers on user-defined bridge networks rather than the default bridge, which gives better isolation and name resolution.
On the image side, build from minimal bases, pin by digest, avoid baking secrets into layers, and scan before publishing—see container image scanning. Use BuildKit secret mounts for build-time credentials, and remember that Docker Content Trust or Cosign signatures are what stop a tampered image being pulled in place of yours.
The CIS Docker Benchmark is the reference configuration baseline, and Docker Bench for Security automates most of its checks against a running host. Run it on every host that runs containers, not just the reference build, because configuration drifts. NIST SP 800-190 remains the clearest narrative guide to the risk categories across images, registries, orchestrators, and hosts.
Finally, keep the host current. The kernel, the Docker Engine, and containerd have each produced escape-grade vulnerabilities, including CVE-2019-5736 and the Leaky Vessels set in January 2024. Patching the host is container security, not a separate activity, and the same applies to the orchestrator if you have moved to Kubernetes—see Kubernetes admission controllers for how to enforce these defaults at scale.
At Privia Security, we test container hosts and platforms through our infrastructure security testing services.
In practice, yes. Anyone who can reach the Docker socket can start a container that mounts the host filesystem and run commands as root inside it, with no further authentication. Treat docker group membership as administrative access to the host, grant it sparingly, review it regularly, and prefer rootless Docker or a sudo-wrapped command for users who only need to run specific workloads.
The Docker API on 2375 is unauthenticated, so anyone who finds it can create containers, mount the host filesystem, and take complete control of the machine. Automated scanning for this port is constant, and compromise typically follows within hours. Never expose it. If remote access is genuinely needed, use TLS with client certificates on 2376 behind a firewall, or an SSH-based Docker context.
No, but it removes the worst outcome. A breakout from a rootless container lands as an unprivileged user rather than as host root, which substantially limits what follows. You still need capability dropping, seccomp, read-only filesystems, image scanning, and host patching. Rootless mode also has limitations around privileged ports, some networking modes, and certain storage drivers.
Run Docker Bench for Security, which automates most of the CIS Docker Benchmark checks against a live host, and review the findings on every host rather than only on the golden image. Supplement it by listing running containers with their flags, looking specifically for privileged mode, socket mounts, host namespaces, and unconfined seccomp. Those four cover most real-world weaknesses.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.