Checkov and KICS with Docker: Scan Compose Files and Dockerfiles for Risky Settings (Linux, Windows, Mac)
Before you start
- 25 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#
Checkov and KICS are two free, open-source scanners that read your infrastructure files and list risky settings before anything runs: KICS reads both Docker Compose files and Dockerfiles, while Checkov reads Dockerfiles only. It has no Compose support at all.
Logo: the official Checkov project (github.com/bridgecrewio/checkov, file docs/web/images/checkov-logo.svg; Apache-2.0). The logo only identifies the tool.
Logo: the official KICS project (github.com/Checkmarx/kics, file docs/img/icon.svg; Apache-2.0). KICS is a Checkmarx project.
Both run briefly, read a folder, print findings and exit. No server or port. We scan dummy files, fix eight findings, suppress one with a reason, and add CI.
| What | Value (official sources, read 5 December 2026) |
|---|---|
| KICS | v2.2.3, released 4 December 2026 (v2.2.2 was 3 December). Apache-2.0. Image checkmarx/kics:v2.2.3, about 78 MB compressed (Docker Hub API) |
| Checkov | 3.4.14, released 1 December 2026. Apache-2.0. Image bridgecrew/checkov:3.4.14, about 190 MB compressed. Pip needs Python 3.10 or newer |
| Example base images | alpine:3.25.0; CI stays on python:3.13-slim (compatibility checked 5 December 2026) |
| Time needed | About 45 minutes (our estimate, not measured) |
| Ports | None |
| Official docs | docs.kics.io and checkov.io |
At a glance:
- Compose files: only KICS (platform
DockerCompose). - Dockerfiles: both. They overlap on root user,
latesttag and missing health check. - Not a CVE scanner. They read settings, not packages. For CVEs in the built image use Trivy or Grype and Syft.
- Read before you pull: the official KICS image on Docker Hub was hijacked for about half an hour on 22 April 2026 (Checkmarx's own window). Pin the digest (Step 2).
| File type | KICS v2.2.3 | Checkov 3.4.14 |
|---|---|---|
compose.yaml | Yes, 21 Docker Compose queries | No |
Dockerfile | Yes, 48 queries | Yes, 28 checks |
| Kubernetes manifests, Helm, Terraform | Yes | Yes (not covered here; see our Kubernetes intro) |
Counts are from the query catalogue and policy index at those tags. Hadolint is a third, Dockerfile-only linter; Docker Bench for Security audits the host.
How it fits together#
You mount your files read-only into a scanner container, it applies its rules and prints findings (plus a JSON or HTML report if you ask), and the exit code tells a CI job whether to fail.
Drawn for this guide. Checkov has no arrow from the Compose file: it cannot read one.
A finding is one rule failing on one line; the rule is a query in KICS and a check in Checkov.
Before you start#
Note: every registry name, image name and value on this page (such as
registry.example.com) is a dummy example. Replace it with your own and never scan or publish real secrets.
| System | What to have |
|---|---|
| Linux | Docker Engine |
| Windows | Windows 10 or later, Docker Desktop (WSL 2), PowerShell |
| Mac | Docker Desktop (Intel or Apple Silicon) |
docker --version
Checklist:
- [ ]
docker --versionprints a version - [ ] About 300 MB of free disk
- [ ] Your own Compose files are in Git, so every fix is reviewable
Tested by DIY Lab Hub: not yet. Commands come from the official docs and source at KICS v2.2.3 and Checkov 3.4.14, read on 5 December 2026. We ran nothing on a real machine, so every "you should see" below is read from the rule files, not copied from a run.
LLM Guide: let your AI assistant set it up#
Prefer to let an AI do the typing? Copy the block below into ChatGPT, Claude, Gemini or a local model. It first asks about your setup, then follows only the path that fits you.
You are my assistant for scanning Docker Compose files with KICS v2.2.3 and Dockerfiles with KICS v2.2.3 and Checkov 3.4.14.
Follow https://diylabhub.com/checkov-kics/ (checked 5 December 2026).
Work one step at a time. Explain each command before running it. Wait for my OK before deleting data, stopping services, changing the router or opening ports.
STEP 0 - FIND OUT MY SETUP:
1. Linux (which distribution), Windows PowerShell or Mac? Check docker --version. Windows uses Docker Desktop with WSL 2; Mac uses Docker Desktop.
2. Which folder holds my Compose files and Dockerfiles? Are they backed up in Git?
3. Do I want the deliberate bad sample, my own files, a suppression example or CI?
4. Is this local scanning, Woodpecker CI or Forgejo Actions? Do not ask for ports or a domain: the scanners listen on no port.
THEN FOLLOW THE MATCHING PATH:
- If Linux or Mac: use ~/docker_volumes/checkov-kics with samples, reports, config and backups. Mount samples read-only and reports writable.
- If Windows: use $HOME\docker_volumes\checkov-kics, New-Item for the folders, the guide's Write-LfFile helper for samples, and quote ${PWD} with braces in volume arguments. Read $LASTEXITCODE after a scan.
- If Compose: use KICS with -t DockerCompose. Checkov has no Compose framework; never suggest --framework docker_compose as a working scan.
- If Dockerfiles: run both scanners. The guide's initial node:latest file is deliberately bad; it is not a deployment recommendation. Use the fixed files from Step 5 when ready.
- If suppressing: use the Step 6 comments with a written reason. Its build-only Dockerfile uses FROM alpine:3.25.0, USER nobody and CMD ["echo", "docs built"].
- If no Docker for Checkov: the guide also permits pip install checkov==3.4.14 in a virtual environment. Prefer the container over Homebrew.
- If HTTPS or a proxy is mentioned: no Traefik labels, Caddy reverse_proxy or public HTML report is needed. These tools are commands, not servers.
PINNED INSTALL AND SCANS (Linux/Mac, from ~/docker_volumes/checkov-kics; use the guide's PowerShell volume syntax on Windows):
docker pull checkmarx/kics:v2.2.3
docker pull bridgecrew/checkov:3.4.14
docker run --rm checkmarx/kics:v2.2.3 version
docker run --rm bridgecrew/checkov:3.4.14 --version
docker buildx imagetools inspect checkmarx/kics:v2.2.3
Compare the digest locally and pin it; do not invent a digest.
docker run --rm -v "$PWD/samples:/src:ro" -v "$PWD/reports:/out" checkmarx/kics:v2.2.3 scan -p /src -t DockerCompose -o /out --output-name kics-compose --report-formats "json,html" --no-progress
docker run --rm -v "$PWD/samples:/tf:ro" -w /tf bridgecrew/checkov:3.4.14 -d /tf --framework dockerfile --skip-download
docker run --rm -v "$PWD/samples:/src:ro" -v "$PWD/reports:/out" checkmarx/kics:v2.2.3 scan -p /src -t Dockerfile -o /out --output-name kics-dockerfile --report-formats "json,html" --no-progress
IF WOODPECKER, save .woodpecker/iac-scan.yaml with these exact pins:
when:
- event: [push, pull_request]
steps:
- name: kics
image: checkmarx/kics:v2.2.3-debian
commands:
- kics scan --no-progress -p . -t DockerCompose,Dockerfile --fail-on critical,high
- name: checkov
image: python:3.13-slim
commands:
- pip install --no-cache-dir checkov==3.4.14
- checkov -d . --framework dockerfile --compact --quiet --skip-download
For Forgejo use the guide's Checkov-only job; it installs Checkov 3.4.14 in a virtual environment. Do not assume its runner has Docker.
CHECK IT WORKED:
The version commands should include 2.2.3 and 3.4.14. Open reports/kics-compose.html locally. The deliberate bad Compose sample should have High findings and KICS exit code 50; Checkov exits 1 on failed checks. Compare findings before and after fixes with the same commands. After the Step 6 suppression, Checkov should show CKV_DOCKER_2 as SKIPPED with the reason. Expected results are from the rules, not a run here.
RULES FOR YOU:
- Keep these versions, including Python 3.13 for CI; never switch to latest or invent options. On error show the exact text and read https://docs.kics.io/ and https://www.checkov.io/ before guessing.
- Never mount docker.sock into a scanner. Keep reports and secrets private; do not publish the HTML report.
- registry.example.com, change-me and the sample health commands are dummy values to replace for the actual app.
- Never ask me to paste passwords, tokens or keys into the chat.
Step 1: Create the folders and the sample files#
Everything lives under ~/docker_volumes/checkov-kics. The sample is deliberately bad: a dummy app (registry.example.com is a dummy value - replace it with your own) with a privileged agent that mounts the Docker socket, and a web service on latest.
Linux#
mkdir -p ~/docker_volumes/checkov-kics/{samples,reports,config,backups}
cd ~/docker_volumes/checkov-kics
cat > samples/compose.yaml << 'EOF'
services:
notes:
image: registry.example.com/notes-app:latest
ports:
- "8080:8080"
agent:
image: registry.example.com/stats-agent:2.3.1
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
EOF
cat > samples/Dockerfile << 'EOF'
FROM node:latest
WORKDIR /app
COPY . .
RUN npm ci
EXPOSE 3000
CMD ["node", "server.js"]
EOF
Windows (PowerShell)#
$base = "$HOME\docker_volumes\checkov-kics"
foreach ($d in "samples","reports","config","backups") {
New-Item -ItemType Directory -Force "$base\$d" | Out-Null
}
Set-Location $base
function Write-LfFile($Path, $Text) { [IO.File]::WriteAllText((Join-Path $PWD $Path), ($Text -replace "`r`n", "`n")) }
Write-LfFile "samples\compose.yaml" @'
services:
notes:
image: registry.example.com/notes-app:latest
ports:
- "8080:8080"
agent:
image: registry.example.com/stats-agent:2.3.1
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
'@
Write-LfFile "samples\Dockerfile" @'
FROM node:latest
WORKDIR /app
COPY . .
RUN npm ci
EXPOSE 3000
CMD ["node", "server.js"]
'@
Write-LfFile writes plain LF line endings. Define it again if you open a new window.
Mac (Terminal)#
Same commands as Linux.
Check it worked. ls samples (Windows: Get-ChildItem samples) shows Dockerfile and compose.yaml.
Step 2: Pull both tools at pinned versions#
We pin exact tags. KICS's own docs still show latest, and on 22 April 2026 an attacker with stolen publisher credentials overwrote the latest, v2.1.20, alpine and debian tags on Docker Hub with a build that sent scan output to the attacker's server (Docker's account, 23 April 2026). Docker restored the repository and advises pinning by digest; Checkmarx says the same.
Linux#
cd ~/docker_volumes/checkov-kics docker pull checkmarx/kics:v2.2.3 docker pull bridgecrew/checkov:3.4.14 docker run --rm checkmarx/kics:v2.2.3 version docker run --rm bridgecrew/checkov:3.4.14 --version
Windows (PowerShell)#
Set-Location "$HOME\docker_volumes\checkov-kics" docker pull checkmarx/kics:v2.2.3 docker pull bridgecrew/checkov:3.4.14 docker run --rm checkmarx/kics:v2.2.3 version docker run --rm bridgecrew/checkov:3.4.14 --version
Mac (Terminal)#
Same commands as Linux.
Check it worked. The last two commands print 2.2.3 and 3.4.14 somewhere in their output (the exact wording is not in the docs and we did not run them). If a pull says the tag was not found, see Troubleshooting.
To pin by digest, read the digest of your own pull and write it behind the tag:
docker buildx imagetools inspect checkmarx/kics:v2.2.3
checkmarx/kics:v2.2.3@sha256:3a4b37f6dc3e76b0169130e670f439f6d58e3a297734ff9ce1ceac5430634120
That digest is what the Docker Hub API gave us on 5 December 2026; compare it with your own (our Buildx guide covers the command). A tag can be moved, a digest cannot.
| Other ways to install | Our verdict |
|---|---|
| Checkov with pip in a virtual environment | Fine: pip install checkov==3.4.14 |
Checkov with brew install checkov | In the docs, but issue 6645 says Homebrew skipped CKV2 checks that pip ran. Prefer pip or Docker |
| KICS as a binary | None: v2.2.3 has no downloadable files and the other documented route is building from source (issue 7833 asks for binaries). Use the image |
Tip: KICS tags can go missing: issue 8135 reports
v2.1.21andv2.2.0absent from Docker Hub for weeks (published 21 October 2026). Check a tag exists before you bump.
Step 3: Scan the Compose file with KICS#
KICS is the only one of the two that reads Compose. We mount the samples read-only and the reports folder writable, and select the platform with -t DockerCompose.
Linux#
cd ~/docker_volumes/checkov-kics docker run --rm -v "$PWD/samples:/src:ro" -v "$PWD/reports:/out" \ checkmarx/kics:v2.2.3 scan -p /src -t DockerCompose \ -o /out --output-name kics-compose --report-formats "json,html" --no-progress echo "exit code: $?"
Windows (PowerShell)#
Set-Location "$HOME\docker_volumes\checkov-kics"
docker run --rm -v "${PWD}\samples:/src:ro" -v "${PWD}\reports:/out" checkmarx/kics:v2.2.3 scan -p /src -t DockerCompose -o /out --output-name kics-compose --report-formats "json,html" --no-progress
"exit code: $LASTEXITCODE"
Mac (Terminal)#
Same commands as Linux.
Options: -p container path, -t platform, -o report folder, --report-formats formats, --no-progress hides progress.
What you should see. One block per query. From the query files at v2.2.3 for our sample:
| KICS query | Severity | Why it fires on our file |
|---|---|---|
| Privileged Containers Enabled | High | privileged: true on agent |
| Docker Socket Mounted In Container | High | the volume's host path contains docker.sock (:ro does not matter) |
| Volume Has Sensitive Host Directory | High | the same line: the path starts with /var |
| Container Traffic Not Bound To Host Interface | Medium | "8080:8080" names no host address |
| Healthcheck Not Set | Medium | two services, two findings |
| Security Opt Not Set | Medium | two services |
| Container Capabilities Unrestricted | Medium | no cap_drop on two services |
The exit code should be 50: the docs map 50 to "found any HIGH results" (60 critical, 40 medium, 30 low, 20 info, 0 clean). A real block looks like this (from KICS issue 8172, v2.2.0, shortened):
Container Capabilities Unrestricted, Severity: MEDIUM, Results: 1 Description: Some capabilities are not needed in certain (or any) containers. Make sure that you only add capabilities that your container needs. Drop unnecessary capabilities as well. Platform: DockerCompose CWE: 400 Risk Score: 6.8 Learn more about this vulnerability: https://docs.kics.io/latest/queries/dockercompose-queries/ce76b7d0-9e77-464d-b86f-c5c48e03e22d [1]: ../../src/compose.yaml:15
Open reports/kics-compose.html in a browser for a readable view.
What it does not say. Neither tool flags image: ...:latest in Compose: KICS has no such query and Checkov cannot read the file. Search for it yourself:
grep -rn ':latest' samples/compose.yaml
On Windows use Select-String ':latest' samples\compose.yaml.
Tip: In PowerShell write
${PWD}with braces.$PWD:/srcis read as a variable with a drive-style prefix and PowerShell refuses it.
Step 4: Scan the Dockerfile with Checkov and KICS#
The Checkov image hands your arguments to the checkov command. --skip-download stops it fetching data from Prisma Cloud (the docs say that also drops doc links and severities); we did not watch the network to see what it fetches otherwise.
Linux#
cd ~/docker_volumes/checkov-kics docker run --rm -v "$PWD/samples:/tf:ro" -w /tf bridgecrew/checkov:3.4.14 -d /tf --framework dockerfile --skip-download echo "exit code: $?" docker run --rm -v "$PWD/samples:/src:ro" -v "$PWD/reports:/out" \ checkmarx/kics:v2.2.3 scan -p /src -t Dockerfile \ -o /out --output-name kics-dockerfile --report-formats "json,html" --no-progress
Windows (PowerShell)#
Set-Location "$HOME\docker_volumes\checkov-kics"
docker run --rm -v "${PWD}\samples:/tf:ro" -w /tf bridgecrew/checkov:3.4.14 -d /tf --framework dockerfile --skip-download
"exit code: $LASTEXITCODE"
docker run --rm -v "${PWD}\samples:/src:ro" -v "${PWD}\reports:/out" checkmarx/kics:v2.2.3 scan -p /src -t Dockerfile -o /out --output-name kics-dockerfile --report-formats "json,html" --no-progress
Mac (Terminal)#
Same commands as Linux.
What you should see. For our Dockerfile both tools should agree on three points:
| Problem | Checkov check | KICS query |
|---|---|---|
Base image node:latest | CKV_DOCKER_7 "Ensure the base image uses a non latest version tag" | Image Version Using 'latest' (Medium) |
No USER, so the container runs as root | CKV_DOCKER_3 "Ensure that a user for the container has been created" | Missing User Instruction (High) |
No HEALTHCHECK | CKV_DOCKER_2 | Healthcheck Instruction Missing (Low) |
Checkov exits with 1 when a check fails. Its output has this shape (from the Checkov docs, for their own sample Dockerfile, not ours):
Check: CKV_DOCKER_3: "Ensure that a user for the container has been created" FAILED for resource: /Dockerfile. File: /Dockerfile:1-8
Now try the Compose command that many guides and assistants suggest. It must fail:
docker run --rm -v "$PWD/samples:/tf:ro" bridgecrew/checkov:3.4.14 -d /tf --framework docker_compose
The message comes from Checkov's main.py at 3.4.14: Invalid frameworks specified: docker_compose. followed by the valid values.
Step 5: Read the eight findings and fix them#
Here are the eight we meet most often, with the fix for each. The last column says who reports it.
| # | Finding | Why it matters | Fix | Reported by |
|---|---|---|---|---|
| 1 | Privileged container | All kernel capabilities and host devices | Delete privileged: true; cap_add only what you need | KICS (High) |
| 2 | docker.sock mounted | Control of that container is control of Docker, which is root on the host | A filtered API through our socket proxy guide | KICS (High) |
| 3 | Sensitive host directory | A bind mount of /etc, /var, /home, /srv and others exposes the host | A narrow path such as ./data | KICS (High) |
| 4 | Running as root | A break-out starts with root rights | USER in the Dockerfile, user: in Compose | Both (Dockerfile) |
| 5 | latest tag | The image changes under you | Pin a version; Diun reports newer ones | Both (Dockerfile only) |
| 6 | No health check | Docker cannot see a stuck app | healthcheck: or HEALTHCHECK | KICS; Checkov (Dockerfile) |
| 7 | No no-new-privileges, no cap_drop | Processes can gain rights and keep default capabilities | security_opt: ["no-new-privileges:true"], cap_drop: ["ALL"] | KICS |
| 8 | Port on all interfaces | "8080:8080" listens on every host network | "127.0.0.1:8080:8080" and a reverse proxy | KICS |
Note: cap_drop: ALL can break an app, so add back only what it needs. user: in Compose is our habit, not a check: KICS has no Compose query for it.
Now the fixed files. The proxy keeps the one socket mount; Step 6 handles it. The health check commands are dummies: use your app's own.
Linux#
cd ~/docker_volumes/checkov-kics
cat > samples/compose.yaml << 'EOF'
services:
notes:
image: registry.example.com/notes-app:1.4.2
restart: unless-stopped
user: "10001:10001"
ports:
- "127.0.0.1:8080:8080"
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8080/health"]
interval: 30s
timeout: 5s
retries: 3
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
agent:
image: registry.example.com/stats-agent:2.3.1
restart: unless-stopped
environment:
- DOCKER_HOST=tcp://socket-proxy:2375
depends_on:
- socket-proxy
networks:
- docker-api
healthcheck:
test: ["CMD", "stats-agent", "healthcheck"]
interval: 30s
timeout: 5s
retries: 3
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
socket-proxy:
image: tecnativa/docker-socket-proxy:3.4
restart: unless-stopped
environment:
CONTAINERS: "1"
POST: "0"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- docker-api
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:2375/_ping"]
interval: 10s
timeout: 3s
retries: 5
networks:
docker-api:
internal: true
EOF
cat > samples/Dockerfile << 'EOF'
FROM node:22.12.0-alpine3.21
WORKDIR /app
COPY . .
RUN npm ci
USER node
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD wget -q --spider http://127.0.0.1:3000/health || exit 1
CMD ["node", "server.js"]
EOF
Windows (PowerShell)#
Set-Location "$HOME\docker_volumes\checkov-kics"
function Write-LfFile($Path, $Text) { [IO.File]::WriteAllText((Join-Path $PWD $Path), ($Text -replace "`r`n", "`n")) }
Write-LfFile "samples\compose.yaml" @'
services:
notes:
image: registry.example.com/notes-app:1.4.2
restart: unless-stopped
user: "10001:10001"
ports:
- "127.0.0.1:8080:8080"
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8080/health"]
interval: 30s
timeout: 5s
retries: 3
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
agent:
image: registry.example.com/stats-agent:2.3.1
restart: unless-stopped
environment:
- DOCKER_HOST=tcp://socket-proxy:2375
depends_on:
- socket-proxy
networks:
- docker-api
healthcheck:
test: ["CMD", "stats-agent", "healthcheck"]
interval: 30s
timeout: 5s
retries: 3
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
socket-proxy:
image: tecnativa/docker-socket-proxy:3.4
restart: unless-stopped
environment:
CONTAINERS: "1"
POST: "0"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- docker-api
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:2375/_ping"]
interval: 10s
timeout: 3s
retries: 5
networks:
docker-api:
internal: true
'@
Write-LfFile "samples\Dockerfile" @'
FROM node:22.12.0-alpine3.21
WORKDIR /app
COPY . .
RUN npm ci
USER node
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD wget -q --spider http://127.0.0.1:3000/health || exit 1
CMD ["node", "server.js"]
'@
Mac (Terminal)#
Same commands as Linux.
Scan both again with the Step 3 and Step 4 commands.
Check it worked. We expect the Dockerfile to pass in both tools. For Compose we expect only the proxy to be reported: the two High findings on its socket line (Docker Socket Mounted In Container, Volume Has Sensitive Host Directory) and two Medium ones (Security Opt Not Set, Container Capabilities Unrestricted). That is read from the rules, not from a run. The tag node:22.12.0-alpine3.21 exists on Docker Hub; use a current patch version of your own base image.
Step 6: Suppress a finding with a reason#
The socket mount on the proxy is intended: it is the one container that holds the socket. Say no, and say why, next to the line.
KICS has no field for a reason, so we write it as a normal comment above the kics-scan comment. Edit samples/compose.yaml and put these two lines above the socket line of socket-proxy:
volumes:
# reason: the only container with the socket; the others reach a filtered, read-only API through it
# kics-scan ignore-line
- /var/run/docker.sock:/var/run/docker.sock:ro
ignore-line hides the next line from every query, so both High findings there disappear. Checkov has a reason built in: #checkov:skip=<check-id>: <reason>, and the output shows SKIPPED with Suppress comment: <reason>. For a build-only image one file can silence a rule in both tools. Create samples/tools/Dockerfile:
Linux#
cd ~/docker_volumes/checkov-kics mkdir -p samples/tools cat > samples/tools/Dockerfile << 'EOF' # reason: build-only image, it exits after the build, so a health check makes no sense #checkov:skip=CKV_DOCKER_2: build-only image, it exits after the build # kics-scan disable=b03a748a-542d-44f4-bb86-9199ab4fd2d5 FROM alpine:3.25.0 USER nobody CMD ["echo", "docs built"] EOF
Windows (PowerShell)#
Set-Location "$HOME\docker_volumes\checkov-kics"
function Write-LfFile($Path, $Text) { [IO.File]::WriteAllText((Join-Path $PWD $Path), ($Text -replace "`r`n", "`n")) }
New-Item -ItemType Directory -Force samples\tools | Out-Null
Write-LfFile "samples\tools\Dockerfile" @'
# reason: build-only image, it exits after the build, so a health check makes no sense
#checkov:skip=CKV_DOCKER_2: build-only image, it exits after the build
# kics-scan disable=b03a748a-542d-44f4-bb86-9199ab4fd2d5
FROM alpine:3.25.0
USER nobody
CMD ["echo", "docs built"]
'@
Mac (Terminal)#
Same commands as Linux.
Put KICS disable=<query id> before any instruction. b03a748a-... means "Healthcheck Instruction Missing". Rerun both Dockerfile scans.
| Way to say no | Scope | Where the reason lives |
|---|---|---|
# kics-scan ignore-line | One line, all KICS queries | A comment above it |
# kics-scan disable=<id> | One file, the queries you list | A comment above it |
--exclude-queries <id> (or exclude-queries in a KICS config file) | The whole scan | A comment in the config |
#checkov:skip=<id>: <reason> | The Dockerfile it is in | In the comment, printed in the output |
--skip-check <id> (Checkov) | The whole run | Nowhere: the check does not run and is not in the output (Checkov docs) |
Check it worked. Checkov lists CKV_DOCKER_2 as SKIPPED for tools/Dockerfile with your reason. KICS no longer shows the socket findings for the proxy line, nor Healthcheck Instruction Missing for tools/Dockerfile. Compose should exit 0 if you gate only on High and Critical (add --fail-on critical,high), as CI does next.
Tip: Commit the reason and the suppression together, and re-read all suppressions after every upgrade.
Run it in CI (Forgejo Actions and Woodpecker)#
KICS fails the job on High or Critical results only, so medium findings stay visible without blocking you. We did not run either pipeline.
Woodpecker CI runs each step in a container and starts your commands with /bin/sh. We use the Debian variant of the KICS image (it has a shell and kics on its path) and a Python image for Checkov. Save as .woodpecker/iac-scan.yaml:
when:
- event: [push, pull_request]
steps:
- name: kics
image: checkmarx/kics:v2.2.3-debian
commands:
- kics scan --no-progress -p . -t DockerCompose,Dockerfile --fail-on critical,high
- name: checkov
image: python:3.13-slim
commands:
- pip install --no-cache-dir checkov==3.4.14
- checkov -d . --framework dockerfile --compact --quiet --skip-download
We avoided ${PWD} here on purpose: Woodpecker substitutes ${...} in the pipeline file itself (its docs, "String Substitution"). For the server and agent see our Woodpecker guide.
We keep Python 3.13: Checkov 3.4.14 lists support through 3.13; its minimum of 3.10 does not establish Python 3.15 compatibility.
Forgejo Actions (runner and docker label: our Forgejo guide). KICS has no binary and runner jobs have no Docker, so this job runs Checkov only. Save as .forgejo/workflows/checkov.yaml:
on: [push, pull_request]
jobs:
checkov:
runs-on: docker
steps:
- uses: actions/checkout@v4
- name: Install Checkov 3.4.14
run: |
set -eu
apt-get update -qq
apt-get install -y -qq python3-venv
python3 -m venv /tmp/ckv
/tmp/ckv/bin/pip install --quiet checkov==3.4.14
- name: Scan Dockerfiles
run: /tmp/ckv/bin/checkov -d . --framework dockerfile --compact --quiet --skip-download
The job image in our Forgejo guide is Debian-based, so apt-get is there; we have not run it. Pin the CI images by digest too, and give the runner few secrets: the April incident hit exactly the jobs that hold credentials.
Put it behind HTTPS with Traefik? You do not need to#
Neither command needs Traefik or Caddy. Open HTML reports from disk; their service names and line numbers are private.
With Traefik#
No labels or routes are needed (no entrypoints=https, no tls.certresolver=le: there is no router).
Without Traefik: Caddy#
No reverse_proxy line is needed for the same reason. For browser tools see our Traefik and Caddy guides, or Dockge and Komodo.
Security and testing#
| Control | How |
|---|---|
| Pin by digest | checkmarx/kics:v2.2.3@sha256:<digest>. In April 2026 the tags were the weak point |
| Read-only input | Samples are mounted :ro. Never mount /var/run/docker.sock into a scanner |
| Root | Both images run as root (neither Dockerfile switches user). Keep containers short-lived |
| Network | We believe neither needs one (Checkov with --skip-download). Try --network none; if a scan fails, remove it. Not tested |
| Crash reports | KICS can send crash reports to Sentry; -e DISABLE_CRASH_REPORT=0 turns that off (docs and source) |
| Pulled in the window | Checkmarx lists 22 April 2026, 12:31 to 12:59 UTC. If a job pulled checkmarx/kics then, rotate every secret it could read |
Our Trivy guide covers the March 2026 incident that came first.
Quick test that nothing is left running (both lists should be empty, because --rm removes the containers):
docker ps --filter ancestor=checkmarx/kics:v2.2.3 docker ps --filter ancestor=bridgecrew/checkov:3.4.14
Common mistakes#
| Mistake | Why it happens | Do this instead |
|---|---|---|
checkov --framework docker_compose fails with Invalid frameworks specified: docker_compose. | Checkov has no Compose framework (its CLI reference lists none; the message is in main.py) | Scan Compose with KICS (-t DockerCompose). We found no Checkov issue about it, only that source |
AI assistants: that same --framework docker_compose, or "Checkov scans your Compose file" | Articles and chat answers blur "Docker checks" with Compose | Read the framework list in checkov --help for your version |
AI assistants: docker run checkmarx/kics:latest ... copied from the docs | The official docs still show latest, the tag the attacker overwrote | Pin v2.2.3, then the digest |
#checkov:skip=CKV_DOCKER_2,CKV_DOCKER_7 in a Dockerfile and both still fail (issue 7799) | The Dockerfile reader takes A,B as one id (we read suppression.py at 3.4.14; the issue is closed, but its fix pull request was closed unmerged) | One comment per check. Separate reasons in one line do not work either (issue 7170) |
no-new-privileges=true is flagged (issue 7077, open) | The KICS query wants the exact text no-new-privileges:true | Use the colon form, or suppress with a reason |
cap_drop: ALL plus a small cap_add is still flagged (issue 8172, open) | The query flags every cap_add | Keep the drop, suppress that line with a reason |
ignore-line hides the wrong line in a file with include: (issue 8078, open) | KICS counts lines after inlining the included file | Avoid include: in scanned files, or review the report |
Expecting :ro on the socket to satisfy KICS | The query only checks that the host path contains docker.sock | Do not mount the socket, or suppress with a reason |
| Memory and CPU limits are never reported | Those queries read the version key, which new Compose files should not have (query files at v2.2.3; issue 6509 is the older report that Compose queries did not load without it) | Set limits by hand; do not add version: to please a tool |
A mistyped id in --check and a green run (issue 7614, open) | Checkov ignores unknown check ids silently | Run once without --check and compare the ids |
Tip: Start CI with
--fail-on critical,highfor KICS. If every severity fails on day one, the team learns to ignore the red build.
Tip: After a fix, rerun the exact same command. A finding that vanishes because you changed the flags is not fixed.
Troubleshooting#
| Problem | Solution |
|---|---|
| Pull fails: tag "not found" | Check the tag on Docker Hub. KICS skipped some for weeks (issue 8135) |
| KICS says nothing about Compose | Use .yaml or .yml (docs say .yaml; the source accepts both), with services: and image: or build: below it |
| Non-zero exit code in CI | That is the point: 60, 50, 40, 30, 20 = critical, high, medium, low, info results; 126 = engine error. Choose with --fail-on |
| Report files belong to root (Linux) | The container runs as root: sudo chown -R "$USER" reports |
| Windows: variable or reference error | Write ${PWD} with braces and quote the whole -v value |
| Checkov complains about a read-only folder | Remove :ro for that run (we did not run it) |
| Garbage characters in saved Checkov output | Remove --tty from docker run (Checkov docs) |
Exact error text#
Invalid frameworks specified: docker_compose.: Checkov, frommain.py. Remove the flag or use KICS.Check: CKV_DOCKER_7: "Ensure the base image uses a non-latest version tag"thenFAILED for resource: /Dockerfile.FROMonFROM ${BASE_IMAGE} AS build(issue 7667): Checkov does not resolve the pinnedARGdefault. Write the tag inFROM.Container Traffic Not Bound To Host Interface, Severity: MEDIUM, Results: 1atdocker-compose.yaml:8, although# kics-scan ignore-linesits above theports:line (issue 8078): a file withinclude:shifted the line numbers.
Known bugs (open, 5 December 2026)#
KICS 8172, 8078, 7077 and 8047 (an anonymous volume reported as "Volume Has Sensitive Host Directory"); Checkov 7667 and 7614. None stops a normal scan. KICS v2.2.3 reverted a Dockerfile parser change from v2.2.2 (pull request 8216) one day before we wrote this, so watch the issue list after you update.
Updates and backups#
Update. Read the release notes (KICS, Checkov), check the tag exists, change it in every command and CI file, and compare the new report with the old one. Checkov releases almost daily: bump on purpose. Diun can tell you about new tags.
What to back up. The scanned files live in Git. Here only config and samples matter, plus your CI files. Reports can be recreated.
Linux and Mac#
Save as ~/docker_volumes/checkov-kics/backup.sh:
#!/usr/bin/env bash set -euo pipefail base="$HOME/docker_volumes/checkov-kics" out="$base/backups/checkov-kics-$(date +%F).tar.gz" tar -czf "$out" -C "$base" samples config chmod 600 "$out"
Run chmod 700 on it and add this line with crontab -e (on a Mac write /Users/<your-user>/...):
0 3 * * 0 /home/<your-user>/docker_volumes/checkov-kics/backup.sh
Windows (PowerShell)#
Save as $HOME\docker_volumes\checkov-kics\backup.ps1:
$base = "$HOME\docker_volumes\checkov-kics" $out = "$base\backups\checkov-kics-$(Get-Date -Format yyyy-MM-dd).tar.gz" tar.exe -czf $out -C $base samples config
In Task Scheduler run powershell.exe -NoProfile -File <full-path-to-the-script> weekly at 03:00.
Restore test. Unpack the archive into a spare folder and run the Step 3 command on its samples. You should see the same findings.
Performance and resources#
The docs give no minimum RAM or CPU and we measured none: run docker stats during a scan of your own files. KICS has a 60-second per-query timeout and skips files over 5 MB (--timeout, --max-file-size). CI installs Checkov from PyPI each run.
FAQ#
Does Checkov scan Docker Compose files? No. Its framework list at 3.4.14 has no Compose entry. Use KICS.
Which one should I use? For Compose stacks KICS covers both file types with one command. Add Checkov if you already use it elsewhere. Hadolint is the quickest Dockerfile-only check.
Do they send my files anywhere? Neither needs an account for these commands. KICS can send crash reports (switch off above). Checkov can fetch data from Prisma Cloud unless you pass --skip-download, and uploads results only with an API key. We did not trace the network.
A scan is clean. Is my stack safe? No. They check settings, not image CVEs or weak passwords.
Sources#
- Base-image review, 5 December 2026: Alpine 3.22, 3.23, 3.24 and 3.25; Python 3.14 and 3.15; Checkov requirements. The Alpine package changes do not affect the echo-only suppression example.
- KICS: repository, release v2.2.3 (4 December 2026, Apache-2.0); docs at that tag: getting started, commands, platforms, ignore comments, exit codes, Compose queries, Dockerfile queries; query files under
assets/queries - Checkov: repository, release 3.4.14 (1 December 2026, Apache-2.0); docs at that tag: installing, suppressing, Docker, Dockerfile policies, PyPI
- Image tags via the Docker Hub API: checkmarx/kics, bridgecrew/checkov
- Incident: Docker, Trivy, KICS, and the shape of supply chain attacks so far in 2026 (23 April 2026); Checkmarx, security updates
- Woodpecker workflow syntax and string substitution at v3.20.1; Forgejo workflow reference
- Issues read on 5 December 2026: KICS 6509, 7077, 7833, 8047, 8078, 8135, 8172; Checkov 6645, 7170, 7614, 7667, 7799
Checked against the official docs on 2026-12-05. Nothing was run on a real machine by DIY Lab Hub; the commands come from the docs, the source and the issues above, and every list of expected findings was read from the rule files.