DockerSelf-Hosting

Docker Bench for Security: Check Your Docker Host Against the CIS Benchmark (Linux, Windows, Mac)

Before you start

  • 20 min read

Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#

Docker Bench for Security is a free shell script from Docker, Inc. that checks your Docker host, daemon settings and running containers against the CIS Docker Benchmark and prints one line per check: PASS, WARN, INFO or NOTE. It only reports; it never changes anything.

Docker Bench for Security official screenshot (no official logo)

Image: Docker Bench for Security project, official screenshot (github.com/docker/docker-bench-security, img/benchmark_log.png at commit 154869d), Apache-2.0. The project has no official logo. The screenshot shows an older version (1.5.0, March 2023).

You read the WARN lines and decide which matter for your homelab. Most need no action; a few, like log limits and published ports, really help. We show both ways to run it, how to read the report, and eight fixes with "what this can break" and how to undo each.

WhatValue (official sources, read 3 December 2026)
Version we pinCommit 154869d on the default branch (4 June 2026). The last tagged release is v1.6.1 (20 December 2023)
Benchmark it implementsCIS Docker Benchmark 1.6.0. CIS published 1.9.0 (for Docker 29.x) in its November 2026 update
LicenceApache-2.0 (LICENSE.md in the repository)
Time and portsAbout 30 minutes for the first scan and reading (our estimate). No port, no web page
Official docsgithub.com/docker/docker-bench-security (the README is the manual)

At a glance:

  • What it is: a bash script with more than 100 small tests, written for Linux Docker hosts.
  • What it is not: not a vulnerability scanner (see our Trivy guide and Grype and Syft guide) and not a runtime alarm (see Falco).
  • Honest limit: the script says "Based on the CIS Docker Benchmark 1.6.0"; CIS has published 1.9.0. A pull request for 1.8.0 (#574, September 2025) was still open on 3 December 2026. Treat the report as a checklist, not a grade.

How it fits together#

You run the script (or its container) on the Docker host. It asks the Docker daemon questions, reads some host files, writes a report, and you decide what to change. It never edits your host.

Docker Bench flow: the script runs from a cloned folder or a privileged container, asks the Docker daemon with docker info and inspect, reads host files such as daemon.json, systemd units and audit rules, writes a log and a JSON report, you read the WARN, PASS, INFO and NOTE lines, then fix one setting by hand and run again to compare

Drawn for this guide from the official README and source. The dashed steps are manual: Docker Bench never does them.

One detail from the source: check 5.7 runs docker exec <container> ps -el inside each running container to look for an SSH server. It is a harmless read, but it is a command in your containers.

Before you start#

Note: every user name, host name and address on this page is a dummy example (<your-user>, <linux-host>, <your-lan-ip>). Replace them with your own.

You need the Linux machine you want to check, with sudo rights. A maintainer wrote in 2018 that the tool "is at the moment only supported on Linux hosts" (issue 350).

SystemWhat to have
LinuxDocker Engine, git, bash, sudo; jq is optional but recommended
WindowsGit for Windows, plus the OpenSSH client (scan a Linux host) or Docker Desktop (scans its Linux VM)
Macgit, ssh, optionally Docker Desktop (same VM limit)
Run in terminalbash
docker --version
git --version
bash --version | head -1
jq --version

Checklist:

  • [ ] docker ps works (with sudo if needed) on the machine that runs your containers
  • [ ] You can edit /etc/docker/daemon.json and restart Docker there (a restart stops containers)

Tested by DIY Lab Hub on 2026-12-03: only in part. The container route ran on Docker Desktop for Windows with a sample daemon.json, and the sh against bash difference ran on Ubuntu in WSL 2 with a stand-in docker command. No full scan on a real Linux host, nothing on a Mac. The rest comes from the README, the source at commit 154869d and Docker's docs.

Tip: Run it with bash, not sh. The README says sudo sh ..., but on Debian and Ubuntu sh is dash and the tests use bash features. In our test [[: not found appeared and check 2.2 warned although "icc": false was set. With bash it passed.

Step 1: Get the code and pin it#

We pin a commit so your report can be repeated. The tagged release v1.6.1 lacks later fixes, such as the one for issue 548 ("File not found" for containerd.sock). The script prints version 1.6.0 on both, so note the commit.

Linux#

Run in terminalbash
mkdir -p ~/docker_volumes/docker-bench-security/{logs,backups}
cd ~/docker_volumes/docker-bench-security
git clone https://github.com/docker/docker-bench-security.git repo
cd repo
git checkout 154869d
git log -1 --format='%h %cI %s'

Windows (PowerShell)#

Turn off line-ending conversion, or Git for Windows makes CRLF scripts and the container build fails (see Common mistakes).

Codepowershell
$base = "$HOME\docker_volumes\docker-bench-security"
foreach ($d in "logs","backups") { New-Item -ItemType Directory -Force "$base\$d" | Out-Null }
Set-Location $base
git clone -c core.autocrlf=false https://github.com/docker/docker-bench-security.git repo
Set-Location repo
git checkout 154869d
git log -1 --format='%h %cI %s'

Mac (Terminal)#

Same commands as Linux.

Check it worked. The last command prints this line (real output from our clone):

File contenttext
154869d 2026-06-04T14:11:51-04:00 chore: pin GitHub Actions to commit SHA (#578)

Step 2: Run the scan on your Linux host#

The script must run from inside the cloned folder: it loads ./functions/ and ./tests/ by relative path. It also creates a log folder there.

Linux#

Run in terminalbash
cd ~/docker_volumes/docker-bench-security/repo
sudo bash docker-bench-security.sh

Windows (PowerShell)#

The script cannot audit Windows. Run it on your Linux host over SSH (Windows ships the client); -t gives sudo a terminal.

Run in terminalpowershell
ssh -t <your-user>@<linux-host> "cd ~/docker_volumes/docker-bench-security/repo && sudo bash docker-bench-security.sh"

Do Step 1 on that host first. For Docker Desktop on your PC see Step 3.

Mac (Terminal)#

Run in terminalbash
ssh -t <your-user>@<linux-host> "cd ~/docker_volumes/docker-bench-security/repo && sudo bash docker-bench-security.sh"

Check it worked. A header "Docker Bench for Security v1.6.0", then "Section A - Check results" with [PASS], [WARN], [INFO] and [NOTE] lines, and "Section C - Score". Without sudo you get "Some tests might require root to run".

Tip: Install jq first (sudo apt install jq on Debian or Ubuntu). Without it the script reads daemon.json with a rough grep and may misjudge a setting.

Step 3: Or run it as a container#

Build the image yourself: the README says the published docker/docker-bench-security image is out of date (issue 405); Docker Hub shows its last update in January 2019. The container shares the host's network, process and user namespaces and mounts host folders, because the tests look at the host.

Linux#

List which mounted paths exist first: Docker creates a missing source folder for a -v mount.

Run in terminalbash
ls -d /etc /usr/bin/containerd /usr/bin/runc /usr/lib/systemd /var/lib

Build and run (on Debian or Ubuntu add -v /lib/systemd/system:/lib/systemd/system:ro, as the README does):

Run in terminalbash
cd ~/docker_volumes/docker-bench-security/repo
docker build --no-cache -t docker-bench-security:local .
sudo docker run --rm --net host --pid host --userns host --cap-add audit_control \
  -e DOCKER_CONTENT_TRUST="${DOCKER_CONTENT_TRUST:-}" \
  -v /etc:/etc:ro \
  -v /usr/bin/containerd:/usr/bin/containerd:ro \
  -v /usr/bin/runc:/usr/bin/runc:ro \
  -v /usr/lib/systemd:/usr/lib/systemd:ro \
  -v /var/lib:/var/lib:ro \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  -v "$HOME/docker_volumes/docker-bench-security/logs:/usr/local/bin/log" \
  --label docker_bench_security \
  docker-bench-security:local

Anything after the image name goes to the script (-b, -c check_5_14); anything before it belongs to docker run.

Windows (PowerShell)#

Docker Desktop runs your containers in a Linux VM, so this scans that VM, not Windows. One line, because the Linux \ continuation does not work in PowerShell.

Codepowershell
Set-Location "$HOME\docker_volumes\docker-bench-security\repo"
docker build --no-cache -t docker-bench-security:local .
docker run --rm --net host --pid host --userns host --cap-add audit_control -v /etc:/etc:ro -v /usr/bin/containerd:/usr/bin/containerd:ro -v /usr/bin/runc:/usr/bin/runc:ro -v /usr/lib/systemd:/usr/lib/systemd:ro -v /var/lib:/var/lib:ro -v /var/run/docker.sock:/var/run/docker.sock:ro -v "$HOME\docker_volumes\docker-bench-security\logs:/usr/local/bin/log" --label docker_bench_security docker-bench-security:local -c container_runtime

A command of this shape ran without a mount error on our Docker Desktop for Windows (single checks only, not a full scan).

Mac (Terminal)#

The README has a macOS variant (an empty /etc/hostname first, fewer mounts; issue 472 shows the error without it). We did not run it on a Mac and the result would describe Docker Desktop's VM anyway. Use the SSH way from Step 2.

Check it worked. The output ends with "Section C - Score" and logs holds docker-bench-security.log and .log.json (real result of our run). Without the mounted log folder --rm deletes them.

Read the report: WARN, PASS, INFO, NOTE#

Real output from our four-check container run on Docker Desktop (a sample daemon.json with dummy values mounted):

File contenttext
[PASS] 2.2 - Ensure network traffic is restricted between containers on the default bridge (Scored)
[PASS] 2.14 - Ensure containers are restricted from acquiring new privileges (Scored)
[PASS] 2.16 - Ensure Userland Proxy is Disabled (Scored)
[WARN] 2.15 - Ensure live restore is enabled (Scored)

[INFO] Checks: 4
[INFO] Score: 2
LabelWhat it meansWhat to do
PASSThe test found the expected settingNothing. It does not prove the host is secure
WARNA recommendation is not metRead it, decide: fix, accept, or document an exception
INFOContext, a sub-line (* File not found) or a section titleRead the text. "File not found" can be a path problem in the tool
NOTEA manual item with no automatic test, such as 2.1 (non-root daemon)Decide it yourself

The score is not a percentage: a scored WARN counts -1, a scored PASS +1, the rest 0 (ours: 3 - 1 = 2).

The check numbers follow the benchmark sections:

SectionTopicGroup name for -c and -e
1Host: partitions, audit rules, trusted usershost_configuration
2Docker daemon settingsdocker_daemon_configuration
3Permissions of Docker files and socketsdocker_daemon_files
4Images and build filescontainer_images
5Running containerscontainer_runtime
6, 7Operations, Swarmdocker_security_operations, docker_swarm_configuration
8Docker Enterprise only (not in a default run)docker_enterprise_configuration

A plain run covers sections 1 to 7; a first scan looks like the screenshot at the top. Check names matter: the README says check_2_2 is the logging level, but at this commit it is the default-bridge traffic check and the logging level is check_2_3. Open tests/2_docker_daemon_configuration.sh before you exclude anything.

Step 4: Pick checks and keep a baseline#

Save the first report as your baseline, then re-run after each change and compare. Options (from the README; -h prints them):

OptionWhat it does
-bNo colours (use it for files)
-l FILEWrite the log to FILE; the JSON goes to FILE.json
-c CHECKS / -e CHECKSRun only, or run all except, these checks or groups (comma separated)
-pPrint "Section B - Remediation measures". In the script -p switches remediation on; the README text says the opposite, and the script is right
-i, -x, -tInclude, exclude or label-filter container and image names

Linux#

Run in terminalbash
cd ~/docker_volumes/docker-bench-security/repo
sudo bash docker-bench-security.sh -b -p -l "$HOME/docker_volumes/docker-bench-security/logs/bench-$(date +%F).log"
sudo bash docker-bench-security.sh -c container_runtime
sudo bash docker-bench-security.sh -e docker_enterprise_configuration,check_2_3
diff -u ../logs/bench-<old-date>.log ../logs/bench-<new-date>.log

Windows (PowerShell)#

Save the SSH output on your PC (for the container, add -b -p after the image name):

Run in terminalpowershell
ssh -t <your-user>@<linux-host> "cd ~/docker_volumes/docker-bench-security/repo && sudo bash docker-bench-security.sh -b -p" | Set-Content "$HOME\docker_volumes\docker-bench-security\logs\bench-$(Get-Date -Format yyyy-MM-dd).log"

Mac (Terminal)#

Run in terminalbash
ssh -t <your-user>@<linux-host> "cd ~/docker_volumes/docker-bench-security/repo && sudo bash docker-bench-security.sh -b -p" > ~/docker_volumes/docker-bench-security/logs/bench-$(date +%F).log

Check it worked. A check name that does not exist prints Check "<name>" doesn't seem to exist. (from the source). Use check_2_2, not 2.2.

Step 5: Apply a daemon change safely#

Most daemon fixes live in /etc/docker/daemon.json. The routine: back up, change one thing, validate, restart in a quiet moment, scan, test your apps. Merge keys into the existing JSON object; never replace a file you have.

Linux#

Run in terminalbash
sudo cp -a /etc/docker/daemon.json ~/docker_volumes/docker-bench-security/backups/daemon.json.$(date +%F-%H%M)
sudo nano /etc/docker/daemon.json
sudo dockerd --validate --config-file=/etc/docker/daemon.json
sudo systemctl restart docker
docker ps

If cp fails the file does not exist yet: create it with { } and add your keys. dockerd --validate checks the file without starting a daemon and prints "configuration OK" (Docker's docs). To undo, copy the backup back and restart Docker.

Windows (PowerShell)#

Docker Desktop has no file you edit by hand: open Settings, then Docker Engine, edit the JSON and choose Apply & restart (Docker's docs). Save the old text first:

Codepowershell
Set-Content "$HOME\docker_volumes\docker-bench-security\backups\desktop-daemon-$(Get-Date -Format yyyy-MM-dd).json" "<paste the old JSON here>"

Mac (Terminal)#

Same as Windows: Settings, then Docker Engine. Save the old text in ~/docker_volumes/docker-bench-security/backups/ first.

Check it worked. docker ps lists your containers again and the line you wanted turns from WARN to PASS. Expect every container to restart (live restore, fix 2, avoids that).

The eight fixes that matter in a homelab#

Pick one, apply it, test, move on. None is mandatory.

1. Limit log size (no check, but the one we would do first)#

Docker's default json-file logs grow without limit (max-size defaults to -1) until the disk is full. The bench does not score this, and check 2.13 (central logging) stays WARN with json-file either way.

File contentjson
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}

The values must be strings, in quotes (Docker's docs). Can break: nothing but history; old lines are dropped. It applies only to containers created afterwards, so run docker compose up -d --force-recreate in each app folder. Undo: remove the keys, restart.

2. Live restore (check 2.15)#

File contentjson
{ "live-restore": true }

Containers keep running while the daemon restarts; Docker's docs say sudo systemctl reload docker applies it with no restart. Can break: little. It skips Swarm services, may fail across major Docker upgrades or changed network or storage options, and a long daemon outage fills the log buffers. Check 2.15 reads the running daemon (docker info), not the file, so it stays WARN until the setting is live (we saw this). Undo: remove, reload.

3. No new privileges by default (check 2.14)#

File contentjson
{ "no-new-privileges": true }

Can break: programs in a container that rely on setuid programs or file capabilities (a sudo or su call). Test each app after a recreate. Undo: remove, restart, recreate. Per app, Compose has security_opt: ["no-new-privileges:true"] (check 5.26).

4. No free talk on the default bridge (check 2.2)#

File contentjson
{ "icc": false }

Docker describes --icc as inter-container communication "for the default bridge network". Compose apps use their own networks, so most homelabs see no change. Can break: plain docker run containers that talk over the default bridge, including old --link setups. Undo: remove, restart.

5. No userland proxy (check 2.16)#

File contentjson
{ "userland-proxy": false }

Can break: some loopback and hairpin cases (the host or a container reaching a published port). The bench's own note says "some networking setups can be impacted". Test curl http://localhost:<port> and your reverse proxy (Traefik, Caddy). Undo: remove, restart.

6. Publish ports only where needed (check 5.14)#

The bench warns for every container with a port on 0.0.0.0 (all interfaces). In Compose, bind to one address:

File contentyaml
    ports:
      - "127.0.0.1:8080:80"        # only this machine
      - "<your-lan-ip>:8081:80"    # only that address (dummy)

Can break: other computers cannot reach a 127.0.0.1 port; put a reverse proxy on the same host in front. Undo: remove the prefix, docker compose up -d.

7. Do not mount the Docker socket (check 5.32)#

The bench names each container with docker.sock mounted ("Docker socket shared: <name>"). Traefik, Dockge or Diun need it, so this WARN is often an accepted exception. :ro protects the socket file, not the Docker API; for a narrower door see our socket proxy guide. Can break: the tool stops working. Undo: put the mount back.

8. Audit rules for Docker files (checks 1.1.3 to 1.1.18)#

auditd records changes to Docker's binary and settings; it watches, it does not block. The bench's remediation text shows the form -w <path> -k docker and the check compares exact paths, so find yours first:

Run in terminalbash
command -v dockerd containerd runc
systemctl show -p FragmentPath docker.service docker.socket

With auditd installed, put lines like these in /etc/audit/rules.d/docker.rules, using the paths you found:

Codetext
-w /usr/bin/dockerd -k docker
-w /etc/docker -k docker
-w <path-to-docker.service> -k docker
Run in terminalbash
sudo augenrules --load
sudo auditctl -l

Not run by us. Can break: watching big folders such as /var/lib/docker can fill the audit log; a missing path stops a rule loading. Undo: delete the file, sudo augenrules --load.

What we leave alone for now#

Check 2.9 (user namespaces) is a migration, not a toggle: Docker's docs say it masks existing images and containers and suggest a fresh install, so practise on a spare VM. Checks 2.7 (daemon TLS) and 2.12 matter only if you expose the daemon on the network; do not. Do not switch rootless Docker to rootful just for the report (issue 556). For new apps, per-container limits (Compose specification) clear checks 5.11, 5.13, 5.26 and 5.29; test each app, some need a writable filesystem:

File contentyaml
    read_only: true
    mem_limit: 512m
    pids_limit: 200
    security_opt:
      - no-new-privileges:true

What works on Docker Desktop (Windows and Mac)#

Part of the reportOn Docker Desktop
Sections 4 and 5 (images, running containers)Useful: they inspect your real containers through the socket
Section 2 (daemon)Partly: edit settings in Settings, Docker Engine; the checks read the VM's daemon
Sections 1 and 3 (host, audit, file permissions)Describes the Desktop VM, which you do not manage. Ignore most WARN lines

Docker Desktop runs the engine in a Linux VM (Docker's networking page), so a scan there says little about Windows or macOS. A WSL shell that talks to Desktop's engine mixes two machines (the daemon is Desktop's, the files are your distro's). For a real result scan a Linux Docker Engine host or VM. The same limit applies to the Colima setup.

Put it behind HTTPS with Traefik? You do not need to#

Docker Bench has no web page and opens no port, so there is nothing to put behind a proxy, at home or on a server with a domain.

With Traefik#

No labels or routes are needed.

Without Traefik: Caddy#

No reverse_proxy line is needed for the same reason. Share a report only privately: it lists your container names, images and settings.

Security and testing#

ControlHow
Scan container power--net host --pid host --userns host, audit_control and host mounts make it a privileged container. Run it only while you scan (--rm)
Docker socketMounting it gives root-level power; :ro is not an API limit. Run only the image you built yourself
ReportsThey map your setup. Keep logs private: chmod 700 ~/docker_volumes/docker-bench-security/logs. Never publish one
ExceptionsWrite down every accepted WARN with reason and date. Never exclude a check just to hide a line

Quick tests after any change:

Run in terminalbash
docker ps
docker info | grep -i "live restore"
sudo bash docker-bench-security.sh -c check_2_14,check_2_15,check_2_16

Common mistakes#

MistakeWhy it happensDo this instead
sudo sh docker-bench-security.sh on Ubuntu or DebianThe README says sh; there it is dash, prints docker-bench-security.sh: 37: [[: not found and check 2.2 warns even with "icc": false (our test; 2.4, 2.5, 2.8, 2.9 and 2.12 use the same test)sudo bash docker-bench-security.sh
Pulling docker/docker-bench-security from Docker Hub (issue 405)Older guides do; the README says it is out of dateBuild it from the pinned commit
Error connecting to docker daemon (does docker ps work?) (197, 556)No socket mount, or sudo on rootless Docker uses root's socketMount /var/run/docker.sock; test sudo docker ps first
Cannot share the host's network namespace when user namespaces are enabled (issue 175)The daemon uses userns-remap and the run command lacks --userns hostUse the full command from Step 3
invalid reference format on Windows (issue 350)A Linux command with \ line ends pasted into PowerShellUse the one-line command from Step 3
docker-bench-security.sh: .: line 15: can't open './functions/functions_lib.sh': No such file or directory (our test, in the container)A Windows clone with CRLF line endings (a wrong folder gives a similar message)cd into the clone; on Windows clone with -c core.autocrlf=false
[INFO] * File not found read as "control missing" (issue 548)Older code looked for containerd.sock in the wrong placeUse the pinned commit; check the path by hand
AI assistants: docker run docker/docker-bench-security:latest "checks the latest CIS benchmark"Old tutorialsBuild from the pinned commit; it implements CIS 1.6.0
AI assistants: "log-opts": {"max-file": 3} with a number, -c 2.2, or "check_2_2 is the logging level" (the README says so)Half-remembered syntax and an outdated READMEStrings in log-opts ("3"); ids are check_2_2 (default-bridge traffic); check_2_3 is the logging level
AI assistants: "the :ro socket mount makes the scan read-only and safe"A mount flag is mistaken for an API limitThe container is privileged; run it briefly

Tip: After any edit run dockerd --validate. If Docker still will not start, a key may be set both in the file and as a systemd flag: "the following directives are specified both as a flag and in the configuration file" (moby issue 25471). Docker's docs say a duplicate stops the daemon whatever its value.

Tip: Change one setting at a time and keep the previous daemon.json; two wrong keys at once are hard to debug. Log rotation will not turn check 2.13 green, and that is fine: it fixes the disk risk, 2.13 asks for central logging.

Troubleshooting#

ProblemSolution
Many [WARN] on the first runNormal. Start with fixes 1, 2 and 6 and ignore the rest until you know them
Some tests might require root to runRun with sudo, or accept a shorter report. Colours in a saved file: add -b
Cannot find the reportThe script writes log/ in the folder you ran it from; in the container /usr/local/bin/log
Docker does not start after an editsudo journalctl -u docker -n 100 --no-pager, then restore the backup daemon.json

Exact error texts#

  • Required program not found: <name>: a tool from awk docker grep sed stat tail tee tr wc xargs is missing (issue 527). ss or netstat command not found.: install iproute2 or net-tools.
  • OCI runtime create failed: ... /merged/etc/hostname: read-only file system on WSL 1 (issue 446) or ... operation not permitted on macOS (issue 472): the mounts do not fit that system.

Known bugs (open, December 2026)#

Open on 3 December 2026: 405 (published image not updated), 446 (WSL 1), 556 (rootless) and pull request 574 (CIS 1.8.0). The newest commit is from June 2026.

Updates and backups#

Update the tool. There is no installer: see what is new, then move the pinned commit.

Run in terminalbash
cd ~/docker_volumes/docker-bench-security/repo
git fetch --tags
git log --oneline HEAD..origin/master
git checkout <new-commit>

Re-run, save a new report and compare (rebuild the image if you use the container). What to back up: the logs folder (your baseline) and the last good daemon.json; keep it and your Compose files in Git. For app volumes see our docker-volume-backup guide.

Linux and Mac#

Save as ~/docker_volumes/docker-bench-security/backup.sh:

File contentbash
#!/usr/bin/env bash
set -euo pipefail
base="$HOME/docker_volumes/docker-bench-security"
out="$base/backups/bench-$(date +%F).tar.gz"
[ -f /etc/docker/daemon.json ] && cp -a /etc/docker/daemon.json "$base/logs/daemon.json.copy"
tar -czf "$out" -C "$base" logs
chmod 600 "$out"

Run chmod 700 on it and add this line with crontab -e (on a Mac use /Users/<your-user>/...; the daemon.json copy is Linux only):

File contenttext
0 3 * * 0 /home/<your-user>/docker_volumes/docker-bench-security/backup.sh

Windows (PowerShell)#

Save as $HOME\docker_volumes\docker-bench-security\backup.ps1:

Codepowershell
$base = "$HOME\docker_volumes\docker-bench-security"
$out = "$base\backups\bench-$(Get-Date -Format yyyy-MM-dd).tar.gz"
tar.exe -czf $out -C $base logs

In Task Scheduler run powershell.exe -NoProfile -File <full-path-to-the-script> weekly at 03:00.

Restore test#

Unpack into a spare folder and look at the baseline:

Run in terminalbash
mkdir -p /tmp/bench-restore && tar -xzf ~/docker_volumes/docker-bench-security/backups/bench-<date>.tar.gz -C /tmp/bench-restore
ls /tmp/bench-restore/logs

You should see your .log and .log.json files again.

Performance and resources#

Docker Bench is a one-shot job: no daemon, no port, nothing to watch between scans. The docs give no RAM or time figures and we measured no full scan, so time it: time sudo bash docker-bench-security.sh -b. The load is mostly docker inspect calls, so it grows with your containers; -i, -x and -t narrow it. For ongoing monitoring see Beszel.

FAQ#

Does Docker Bench fix anything? No. It reads, runs docker ps, info and inspect, and prints; -p only prints suggested remediation text. Aim for settings you understand, not a high score.

What are the alternatives? They answer other questions. Dockle (Apache-2.0, v0.4.15, January 2025) lints a built image. Lynis (GPL-3.0, 3.1.7, June 2026) audits the whole operating system. For image vulnerabilities use Trivy, for Dockerfile style hadolint, for live abuse Falco or CrowdSec.

Sources#

Checked against the official docs on 2026-12-03. Partly tested by DIY Lab Hub that day: the container build and run on Docker Desktop for Windows with a sample file, and the sh against bash difference on Ubuntu in WSL 2. No full scan on a real Linux host, nothing on a Mac. The audit and Compose snippets come from the docs and the tool's own text.

Try one of these