Docker Compose security checker
Paste a compose.yaml and find privileged containers, the Docker socket, host networking, database ports open to the internet and secrets in environment.
Checked as you type. Nothing you paste leaves this page.
The file is read in your browser. It is not uploaded.
Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.
How to use the docker Compose security checker
- Paste the Compose file, drop it, or load the example.
- Start with critical findings: they give a container control of the host.
- For each published database port, remove the mapping or bind it to 127.0.0.1.
- Move secrets to an untracked .env file or to Compose secrets, and rotate the old ones.
About this tool
A Compose file is often the whole deployment of a small product, and its short syntax hides sharp edges. A line such as "5432:5432" publishes the database on every network interface, and Docker opens that port with its own firewall rules, which are evaluated before ufw or firewalld. Many exposed databases on the internet got there this way.
This checker reads each service and reports the settings that hand over the host or the data: privileged mode, host network and PID namespaces, the Docker socket or the root filesystem mounted in, dangerous capabilities, database and admin ports published without a loopback address, literal secrets and default passwords in environment, and images on latest.
Anchors, aliases and merge keys are followed, and values that come from variables are left alone. The rules are a starting point and do not replace a review of what each service can reach, or of the networks and volumes the services share. Secrets the checker finds are shown redacted, never in full.
Sources
Questions
Docker publishes ports by adding its own iptables rules, and those are evaluated before the rules ufw manages. A port mapped as "5432:5432" is reachable from outside whatever ufw says. Bind it to loopback with "127.0.0.1:5432:5432", or remove the mapping if only other containers use the service.
Yes. Anything that can talk to the Docker socket can start a privileged container that mounts the host’s disk, which is root on the host. Mounting it read-only does not help, because API requests still go through. Use a socket proxy that allows only the calls the service needs.
It gives the container every Linux capability and access to all host devices, and turns off most of the isolation Docker provides. A process in a privileged container can mount the host’s filesystems and load kernel modules. Add the one capability or device you need instead.
Not in the file. Reference a variable (${DB_PASSWORD}) and keep the value in a .env file that is in .gitignore, or use the top-level secrets element, which mounts each secret as a file under /run/secrets inside the container.