Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

dockle

> DevOps
Open source

Container Image Linter for Security, Helping build the Best-Practice Docker Image, Easy to start

3.3K stars0 likes1 views
WebsiteGitHub

About

Container Image Linter for Security, Helping build the Best-Practice Docker Image, Easy to start

Dockle - Container Image Linter for Security, Helping build the Best-Practice Docker Image, Easy to start

Dockle helps you:

  1. Build Best Practice Docker images
  2. Build secure Docker images
    • Checkpoints includes CIS Benchmarks
bash
$ brew untap goodwithtech/dockle # who use 0.1.16 or older version
$ brew install goodwithtech/r/dockle
$ dockle [YOUR_IMAGE_NAME]

See Installation and Common Examples

Checkpoints Comparison

TOC

  • Features
  • Comparison
  • Installation
    • Homebrew (Mac OS X / Linux and WSL)
    • RHEL/CentOS
    • Debian/Ubuntu
    • Arch Linux
    • Windows
    • Microsoft PowerShell 7
    • Binary
    • asdf
    • mise
    • From source
    • Use Docker
  • Quick Start
    • Basic
    • Docker
  • Checkpoint Summary
  • Common Examples
    • Scan an image
    • Scan an image file
    • Get or Save the results as JSON
    • Get or Save the results as SARIF
    • Specify exit code
    • Specify exit level
    • Ignore the specified checkpoints
    • Accept suspicious environment variables / files / file extensions
    • Reject suspicious environment variables / files / file extensions
  • Continuous Integration
    • GitHub Action
    • Travis CI
    • CircleCI
    • GitLab CI
    • Authorization for Private Docker Registry
      • Docker Hub
      • Amazon ECR (Elastic Container Registry)
      • GCR (Google Container Registry)
      • Self Hosted Registry (BasicAuth)
  • Contributors
    • Code Contributors
    • Financial Contributors
      • Individuals
      • Organizations
  • License
  • Author

Features

  • Detect container's vulnerabilities
  • Helping build best-practice Dockerfile
  • Simple usage
    • Specify only the image name
    • See Quick Start and Common Examples
  • CIS Benchmarks Support
    • High accuracy
  • DevSecOps
    • Suitable for CI such as Travis CI, CircleCI, Jenkins, etc.
    • See CI Example

Comparison

Dockle Hadolint Docker Bench for Security Clair
Target Image Dockerfile Host
Docker Daemon
Image
Container Runtime
Image
How to run Binary Binary ShellScript Binary
Dependency No No Some dependencies No
CI Suitable ✓ ✓ x x
Purpose Security Audit
Dockerfile Lint
Dockerfile Lint Security Audit
Dockerfile Lint
Scan Vulnerabilities

Installation

Homebrew (Mac OS X / Linux and WSL)

You can use Homebrew on Mac OS X or Linux and WSL (Windows Subsystem for Linux).

bash
$ brew install goodwithtech/r/dockle

RHEL/CentOS

bash
VERSION=$(
 curl --silent "https://api.github.com/repos/goodwithtech/dockle/releases/latest" | \
 grep '"tag_name":' | \
 sed -E 's/.*"v([^"]+)".*/\1/' \
) && rpm -ivh https://github.com/goodwithtech/dockle/releases/download/v${VERSION}/dockle_${VERSION}_Linux-64bit.rpm

Debian/Ubuntu

bash
VERSION=$(
 curl --silent "https://api.github.com/repos/goodwithtech/dockle/releases/latest" | \
 grep '"tag_name":' | \
 sed -E 's/.*"v([^"]+)".*/\1/' \
) && curl -L -o dockle.deb https://github.com/goodwithtech/dockle/releases/download/v${VERSION}/dockle_${VERSION}_Linux-64bit.deb
$ sudo dpkg -i dockle.deb && rm dockle.deb

Arch Linux

dockle can be installed from the Arch User Repository using dockle or dockle-bin package.

bash
git clone https://aur.archlinux.org/dockle-bin.git
cd dockle-bin
makepkg -sri

Windows

bash
VERSION=$(
 curl --silent "https://api.github.com/repos/goodwithtech/dockle/releases/latest" | \
 grep '"tag_name":' | \
 sed -E 's/.*"v([^"]+)".*/\1/' \
) && curl -L -o dockle.zip https://github.com/goodwithtech/dockle/releases/download/v${VERSION}/dockle_${VERSION}_Windows-64bit.zip
$ unzip dockle.zip && rm dockle.zip
$ ./dockle.exe [IMAGE_NAME]

Microsoft PowerShell 7

bash
if (((Invoke-WebRequest "https://api.github.com/repos/goodwithtech/dockle/releases/latest").Content) -match '"tag_name":"v(?<ver>[^"]+)"') {
$VERSION=$Matches.ver &&
Invoke-WebRequest "https://github.com/goodwithtech/dockle/releases/download/v${VERSION}/dockle_${VERSION}_Windows-64bit.zip" -OutFile dockle.zip &&
Expand-Archive dockle.zip && Remove-Item dockle.zip }

Binary

You can get the latest version binary from releases page.

Download the archive file for your operating system/architecture. Unpack the archive, and put the binary somewhere in your $PATH (on UNIX-y systems, /usr/local/bin or the like).

  • NOTE: Make sure that it's execution bits turned on. (chmod +x dockle)

asdf

You can install dockle with the asdf version manager with this plugin, which automates the process of installing (and switching between) various versions of github release binaries. With asdf already installed, run these commands to install dockle:

bash
# Add dockle plugin
asdf plugin add dockle

# Show all installable versions
asdf list-all dockle

# Install specific version
asdf install dockle latest

# Set a version globally (on your ~/.tool-versions file)
asdf global dockle latest

# Now dockle commands are available
dockle --version

mise

You can install dockle with mise, the polyglot tool versions manager. With mise already installed, run these commands to install dockle:

bash
# Show all installable versions
mise ls-remote dockle

# Install specific version
mise install dockle@latest

# Set a version globally
mise use -g dockle@latest

# Now dockle commands are available
dockle --version

From source

bash
$ GO111MODULE=off go get github.com/goodwithtech/dockle/cmd/dockle
$ cd $GOPATH/src/github.com/goodwithtech/dockle && GO111MODULE=on go build -o $GOPATH/bin/dockle cmd/dockle/main.go

Use Docker

There's a Dockle image on Docker Hub also. You can try dockle before installing the command.

bash
$ VERSION=$(
 curl --silent "https://api.github.com/repos/goodwithtech/dockle/releases/latest" | \
 grep '"tag_name":' | \
 sed -E 's/.*"v([^"]+)".*/\1/' \
) && docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
  goodwithtech/dockle:v${VERSION} [YOUR_IMAGE_NAME]

You only need -v /var/run/docker.sock:/var/run/docker.sock when you'd like to scan the image on your host machine.

Quick Start

Basic

Simply specify an image name (and a tag).

bash
$ dockle [YOUR_IMAGE_NAME]
Result
…

Docker

Also, you can use Docker to use dockle command as follow.

bash
$ export DOCKLE_LATEST=$(
 curl --silent "https://api.github.com/repos/goodwithtech/dockle/releases/latest" | \
 grep '"tag_name":' | \
 sed -E 's/.*"v([^"]+)".*/\1/' \
)
$ docker run --rm goodwithtech/dockle:v${DOCKLE_LATEST} [YOUR_IMAGE_NAME]
  • If you'd like to scan the image on your host machine, you need to mount docker.sock.

    bash
    $ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ...

Checkpoint Summary

  • Details of each checkpoint see CHECKPOINT.md
CODE DESCRIPTION LEVEL※
CIS's Docker Image Checkpoints
CIS-DI-0001 Create a user for the container WARN
CIS-DI-0002 Use trusted base images for containers FATAL
CIS-DI-0003 Do not install unnecessary packages in the container FATAL
CIS-DI-0004 Scan and rebuild the images to include security patches FATAL
CIS-DI-0005 Enable Content trust for Docker INFO
CIS-DI-0006 Add HEALTHCHECK instruction to the container image INFO
CIS-DI-0007 Do not use update instructions alone in the Dockerfile FATAL
CIS-DI-0008 Confirm safety of setuid and setgid files INFO
CIS-DI-0009 Use COPY instead of ADD in Dockerfile FATAL
CIS-DI-0010 Do not store secrets in Dockerfiles FATAL
CIS-DI-0011 Install verified packages only INFO
Dockle Checkpoints for Docker
DKL-DI-0001 Avoid sudo command FATAL
DKL-DI-0002 Avoid sensitive directory mounting FATAL
DKL-DI-0003 Avoid apt-get dist-upgrade WARN
DKL-DI-0004 Use apk add with --no-cache FATAL
DKL-DI-0005 Clear apt-get caches FATAL
DKL-DI-0006 Avoid latest tag WARN
Dockle Checkpoints for Linux
DKL-LI-0001 Avoid empty password FATAL
DKL-LI-0002 Be unique UID/GROUPs FATAL
DKL-LI-0003 Only put necessary files INFO

Level

Dockle has 5 check levels.

LEVEL DESCRIPTION
FATAL Be practical and prudent
WARN Be practical and prudent, but limited uses (even if official images)
INFO May negatively inhibit the utility or performance
SKIP Not found target files
PASS Not found any problems

Common Examples

Scan an image

Simply specify an image name (and a tag).

bash
$ dockle goodwithtech/test-image:v1
Result
…

Scan an image file

bash
$ docker save alpine:latest -o alpine.tar
$ dockle --input alpine.tar

Get or Save the results as JSON

bash
$ dockle -f json goodwithtech/test-image:v1
$ dockle -f json -o results.json goodwithtech/test-image:v1
Result
…

Get or Save the results as SARIF

bash
$ dockle -f sarif goodwithtech/test-image:v1
$ dockle -f sarif -o results.json goodwithtech/test-image:v1
Result
…

Specify exit code

By default, Dockle exits with code 0 even if there are some problems.

Use the --exit-code, -c option to exit with a non-zero exit code if WARN or FATAL alert were found.

bash
$ dockle --exit-code 1 [IMAGE_NAME]

Specify exit level

By

Issues· 53 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gocontainersdockergogolang

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理