Last reviewed: September 2026
Dockle is an open-source linter for Docker and OCI container images. It examines image contents and configuration for security and operational issues, including sensitive files, risky permissions, missing health checks and CIS-aligned image practices.
Dockle complements vulnerability scanners; it does not replace them. Use a vulnerability scanner to find known package and dependency vulnerabilities, and use Dockle to review how the image was assembled and configured.
What Dockle checks
- CIS-aligned container-image checkpoints.
- Sensitive or suspicious files copied into image layers.
- Execution as the root user and risky setuid or setgid files.
- Missing HEALTHCHECK configuration.
- Unpinned or risky image-building practices.
- Package-manager caches and unnecessary image contents.
- Potential secrets exposed through files or environment configuration.
Understand result levels
| Level | Meaning |
|---|---|
| FATAL | High-priority finding that should normally block a controlled build |
| WARN | Hardening recommendation requiring review |
| INFO | Informational or lower-severity advice |
| SKIP | Check was skipped or could not be evaluated |
| PASS | Applicable check passed |
A severity label is not a complete risk decision. Review the finding, image purpose, runtime controls and compensating safeguards before suppressing it.
Install Dockle
Use the upstream release page and checksums for Linux packages or archives. Confirm the current release and processor architecture before installation; do not copy a stale version number into automation.
The upstream project also provides a Homebrew tap for macOS and supported Linux environments.
brew install goodwithtech/r/dockle
dockle --versionFor CI runners, pin an approved release and verify its checksum. Review the project release activity and open issues before treating the tool as a long-term control.
Scan a local image
Build the image with an immutable CI tag, then run Dockle against that tag.
docker build -t example-app:build-123 .
dockle example-app:build-123Read every FATAL and WARN result. Fix the Dockerfile or build context where possible, rebuild the image and scan again.
Fail a build on findings
Set an explicit exit policy so CI does not succeed merely because the scanner produced output.
dockle --exit-code 1 --exit-level fatal example-app:build-123Start with a reviewed baseline, then tighten the policy deliberately. A sudden strict policy on an existing image estate can create broad suppressions instead of durable fixes.
Typical Dockerfile improvements
- Use a minimal, trusted base image and pin it according to your update policy.
- Install only required packages and remove package-manager caches in the same layer.
- Create and use a non-root user when the workload permits it.
- Copy only required build artifacts into the runtime stage.
- Keep credentials and environment-specific secrets out of the image and build context.
- Add a meaningful health check when the runtime platform uses it.
- Use multi-stage builds to separate compilers and build dependencies from the runtime image.
Use suppressions carefully
Some findings can be intentional or inapplicable. Document the reason, scope the exception to the exact check and image, assign an owner and expiration date, and review it after base-image or application changes.
- Never suppress a finding only to make the pipeline green.
- Do not place real secrets in ignore files or CI logs.
- Keep the exception near the policy configuration and under code review.
- Remove the exception when the underlying condition is fixed.
CI/CD workflow
- Build the image with a unique, immutable tag.
- Scan dependencies and operating-system packages with a vulnerability scanner.
- Run Dockle for configuration and image-construction checks.
- Store machine-readable results as pipeline artifacts when supported.
- Fail the pipeline according to the approved severity policy.
- Sign and publish only the image digest that passed all required controls.
- Re-scan stored images when vulnerability intelligence or policy changes.
Common problems
- Image not found: confirm the exact tag and Docker daemon or registry access.
- Private registry denied: use the registry's supported short-lived authentication flow and protect credentials.
- False positive: verify the check against the current upstream issue tracker before suppressing it.
- Different local and CI results: compare Dockle versions, image digests, policy flags and runtime access.
- Slow or unreliable scans: cache approved tooling and avoid downloading unverified binaries during every build.
- No vulnerabilities reported: remember that Dockle is not primarily a CVE scanner.
Security limitations
No single image scanner proves that a container is safe. Combine image linting with vulnerability management, secret scanning, software bills of materials, image signing, admission policy, least-privilege runtime settings, network controls, monitoring and patching.
Official references
Join the discussion
0 CommentsAsk questions, add context, or share what worked.
More from Melochip Editorial
Learn what Playwright testing is, why modern QA teams use it, how testers can get started, and the major types...
7 min read · Sep 19, 2026
Learn how Kubernetes Deployments and ReplicaSets work with practical YAML, scaling, self-healing, rolling upda...
7 min read · Sep 17, 2026
Learn Kubernetes security best practices with RBAC, Secrets, ServiceAccounts, Pod securityContext, NetworkPoli...
6 min read · Sep 17, 2026Related articles
Learn Docker registries, image tags, Docker Hub, private registries, login, push, pull, naming rules, CI/CD us...
2 min read · Sep 17, 2026
Learn Docker security best practices for images, containers, users, secrets, registries, scanning, least privi...
2 min read · Sep 17, 2026
Learn Kubernetes security best practices with RBAC, Secrets, ServiceAccounts, Pod securityContext, NetworkPoli...
6 min read · Sep 17, 2026
Learn Kubernetes ConfigMaps and Secrets with YAML, environment variables, file mounts, update behavior, immuta...
8 min read · Sep 17, 2026Stay in the loop. Get new Melochip articles
Receive Melochip article updates when new articles are available. Explicit opt-in only.
No comments yet. Start the discussion.