Read-only Docker host and container baseline checker with CIS Docker Benchmark ids (MIT, free; pipx install) https://errant.solutions/tools/docker-baseline-auditor.html
  • Python 91.2%
  • Shell 8.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Claude Code 8365e628eb
All checks were successful
tests / audit (push) Successful in 33s
tests / test (3.8) (push) Successful in 2m35s
tests / test (3.14) (push) Successful in 2m35s
docs: security contact moves to security@support.errant.solutions (author email in package metadata too); signing-key UID text unchanged
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-30 10:29:41 -08:00
.forgejo/workflows ci+tests: kill the 82 real mutation survivors; retry the checkout; floor 71 -> 98 2026-11-24 21:22:11 -08:00
ci mutation container carries the rustinion.ci.job label (Rustinion treats it as a CI job container, no CVE findings) 2026-11-28 03:48:33 -08:00
docs Shared CLI contract: exit codes, --json schema_version, --quiet, contract tests 2026-11-23 15:13:32 -08:00
keys release: sign SHA256SUMS with the Errant Solutions release key 2026-11-17 10:27:15 -08:00
schema Shared CLI contract: exit codes, --json schema_version, --quiet, contract tests 2026-11-23 15:13:32 -08:00
tests ci+tests: kill the 82 real mutation survivors; retry the checkout; floor 71 -> 98 2026-11-24 21:22:11 -08:00
.gitignore nightly mutation: incremental (only functions changed since the last green run) except a weekly full run on the repo's own weekday; replace-queued concurrency; staggered cron 2026-10-18 12:22:49 -07:00
CHANGELOG.md Shared CLI contract: exit codes, --json schema_version, --quiet, contract tests 2026-11-23 15:13:32 -08:00
claims.json Shared CLI contract: exit codes, --json schema_version, --quiet, contract tests 2026-11-23 15:13:32 -08:00
docker_baseline_auditor.py Shared CLI contract: exit codes, --json schema_version, --quiet, contract tests 2026-11-23 15:13:32 -08:00
LICENSE Add MIT LICENSE file 2026-10-16 14:07:53 -07:00
pyproject.toml docs: security contact moves to security@support.errant.solutions (author email in package metadata too); signing-key UID text unchanged 2026-11-30 10:29:41 -08:00
README.md Shared CLI contract: exit codes, --json schema_version, --quiet, contract tests 2026-11-23 15:13:32 -08:00
SECURITY.md docs: security contact moves to security@support.errant.solutions (author email in package metadata too); signing-key UID text unchanged 2026-11-30 10:29:41 -08:00

docker-baseline-auditor

Read-only Docker security baseline checker for the host you run it on: the daemon's configuration, the Docker host's files and every running container, checked against the CIS Docker Benchmark v1.6.0. Every finding carries its CIS recommendation id, so results line up with the benchmark (and with Docker Bench for Security). Zero dependencies beyond a working docker CLI.

Area CIS ids
Daemon: icc on the default bridge, log level, insecure registries, aufs, TCP socket without TLS, user namespaces/rootless, centralized logging, no-new-privileges default, live restore, userland proxy, experimental features 2.2 2.3 2.5 2.6 2.7 2.9 2.13 2.14 2.15 2.16 2.18
Host files (local daemon only): docker.service/docker.socket units, /etc/docker, daemon.json, the Docker socket (owner + mode) 3.1-3.6 3.15-3.18
Docker Content Trust not enabled 4.5
Containers: configured to run as root, AppArmor/seccomp unconfined, added capabilities, privileged, sensitive host paths mounted (/, /etc, /proc, /var/run...), privileged host ports, host network, memory limit, writable root filesystem, ports published on every interface, restart policy without a retry cap (always/unless-stopped/on-failure over 5), host PID/IPC/UTS/user namespaces, host devices, shared mount propagation, no-new-privileges, health check, pids limit, Docker socket mounted 4.1 5.2 5.4 5.5 5.6 5.8 5.10 5.11 5.13 5.14 5.15 5.16 5.17 5.18 5.20 5.21 5.22 5.26 5.27 5.29 5.31 5.32
:latest/untagged images (ops hygiene) -

Static scan of Dockerfiles and Compose files

Catch the same problems before anything is built or started. No docker CLI or daemon is needed:

docker-baseline-auditor --dockerfile .                       # every Dockerfile / *.Dockerfile / Containerfile under .
docker-baseline-auditor --compose docker-compose.yml --json  # one result per service
docker-baseline-auditor --dockerfile Dockerfile --compose . --live   # static files plus the live daemon and containers
Scanned Findings (CIS id)
Dockerfile final stage runs as root (4.1), no HEALTHCHECK (4.6), apt-get update on its own RUN line (4.7), ADD instead of COPY or ADD of a URL (4.9), secrets in ENV/ARG (4.10), :latest/untagged base images, a download piped into a shell, EXPOSE 22, world-writable chmod
Compose per service: user (4.1), seccomp/AppArmor unconfined, added capabilities, privileged, sensitive host paths and the Docker socket mounted, privileged and all-interface ports, host network/PID/IPC/UTS/user namespaces, devices, shared propagation, memory/pids limits, read-only root, restart policy, no-new-privileges, health check (5.2 5.4 5.5 5.6 5.8 5.10 5.11 5.13 5.14 5.15 5.16 5.17 5.18 5.20 5.21 5.22 5.26 5.27 5.29 5.31 5.32), hardcoded secrets in environment, :latest images

--include, --exclude, --fail-on and --json apply to the static findings too (--json adds a files list). Compose files are read with a built-in YAML subset (anchors, << merges, flow lists, quoted strings); a file it can't parse is an error (exit 2), never a silent pass. Variable defaults like ${SOCK:-/var/run/docker.sock} are judged by their default.

"Run as root" means the container's configured USER (what docker inspect shows), not a live process listing.

Install

pipx install git+https://git.canutethegreat.com/CanuteTheGreat/docker-baseline-auditor.git        # latest release branch; puts `docker-baseline-auditor` on PATH
pipx install git+https://git.canutethegreat.com/CanuteTheGreat/docker-baseline-auditor.git@v1.4.0  # a pinned release
brew install canutethegreat/errant-tools/docker-baseline-auditor   # after: brew tap canutethegreat/errant-tools https://git.canutethegreat.com/CanuteTheGreat/homebrew-errant-tools
scoop install errant-tools/docker-baseline-auditor                 # after: scoop bucket add errant-tools https://git.canutethegreat.com/CanuteTheGreat/scoop-errant-tools

Or download the single file (stdlib-only Python 3.8+) and run it directly: curl -fsSLO https://errant.solutions/downloads/docker_baseline_auditor.py && python3 docker_baseline_auditor.py --help. Every release has a changelog, the wheel, the sdist and a SHA256SUMS file. The checksums are signed (SHA256SUMS.asc). Verify: gpg --verify SHA256SUMS.asc SHA256SUMS (key: https://errant.solutions/signing-key.asc, fingerprint 5439 3549 39B9 C055 2A68 E9BB E323 A6A3 AC0A 6506, also in keys/release-signing.asc). Not on PyPI yet, so plain pipx install docker-baseline-auditor doesn't work until it's published there.

Usage

docker-baseline-auditor                       # text report
docker-baseline-auditor --json                # machine-readable, for CI
docker-baseline-auditor --fail-on medium      # CI gate: exit 1 on MEDIUM or worse
docker-baseline-auditor --exclude 5.27,2.13   # skip checks/sections by CIS id
docker-baseline-auditor --include 5 --all     # only container checks, including stopped containers
docker-baseline-auditor --version

Read-only: docker info, docker network inspect bridge, docker ps and docker inspect, plus stat() on the local Docker files. Never modifies anything. No network calls, no data leaves the host. With a remote DOCKER_HOST the host-file checks (3.x) are skipped and the report says so.

Exit codes (the shared Errant Solutions CLI contract, see docs/CLI-CONTRACT.md):

Code Meaning
0 no finding at or above --fail-on (default high)
1 at least one finding at or above --fail-on
2 bad usage or input error (e.g. a --dockerfile path that doesn't exist); also (legacy, kept so existing scripts keep working) the docker CLI is missing or the daemon can't be reached
3 unexpected runtime error (message on stderr)

--json prints {"schema_version", "tool", "version", "exit_code", "engine", "daemon": [findings], "containers": [{"name", "image", "findings"}], "files", "summary"} where each finding is {"id": "5.5", "severity": "HIGH", "message": "..."}; schema_version is currently 1 and its JSON Schema is schema/docker-baseline-auditor.schema.json. Errors are never printed as JSON: the message goes to stderr and stdout stays empty. --quiet (-q) prints nothing on stdout, so the exit code is the whole answer.

License / pricing

MIT — see LICENSE. Free, pay-what-you-want. If it's useful, there's a payment link on https://errant.solutions. No obligation.

Part of the Errant Solutions spare-capacity tools series (see also: sshd-hardening-auditor, tls-cert-watchdog, mail-security-auditor, aws-waste-finder).

Tests

tests/ exercises every option and check end-to-end (against real containers on a real Docker engine) in Forgejo CI on Python 3.8 and current Python, then installs the package with pip and checks\n--version/--help; sh ci/run-tests.sh 3.13 reproduces it locally (needs docker).