scan_dockerfile
Scan a Dockerfile for security misconfigurations using Trivy before building. Detects missing USER, 'latest' tags, hardcoded secrets, missing HEALTHCHECK, and ADD usage. Requires trivy CLI installed.
Instructions
Scans a Dockerfile for security misconfigurations using Trivy's config
scanner — BEFORE the image is even built. Flags things like: missing
USER directive (container would run as root), use of the "latest" tag,
hardcoded secrets in ENV/ARG, missing HEALTHCHECK, and use of ADD instead
of COPY. Requires the trivy CLI installed and on PATH (https://trivy.dev).
Args: dockerfile_path: full path to an existing Dockerfile on this machine. Accepts either a Windows path ("C:\path\Dockerfile") or a Git Bash style path ("/c/path/Dockerfile"). severity: comma-separated severities to include (default "CRITICAL,HIGH")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| severity | No | CRITICAL,HIGH | |
| dockerfile_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |