Skip to content
KitploitKITPLOIT
ToolsBlog
Einreichen
ToolsBlog
Einreichen

Hacking-, PenTest- und Cybersicherheits-Tools für Ihr Sicherheitsarsenal!

Kitploit ist ein Verzeichnis von Hacking-, Cybersicherheits- und Pentesting-Tools. Entdecken Sie die neuesten Projekt-Updates, um Schwachstellen zu finden, Systeme zu analysieren, Tests zu automatisieren und Ihre Sicherheit zu stärken.

··Feeds·Kontakt·Datenschutz·© 2026 Kitploit

Tool-Verzeichnis

Kategorien

Alle Kategorien anzeigen
Loading categories
dockle — Container-Image-Linter für Sicherheit, hilft beim Erstellen des Docker-Images nach Best Practices, einfach zu starten | Kitploit
Tools/GitHubGitHub/goodwithtech/dockle
SchwachstellenscannerContainer-SicherheitKonfigurationsprüfungDevSecOps
GitHubgoodwithtech/dockle

dockle

Container-Image-Linter für Sicherheit, hilft beim Erstellen des Docker-Images nach Best Practices, einfach zu starten

Repository anzeigen
3.3k1666vor 2 MonatenVon Kitploit geprüft
Webseite

Beliebteste

Alle anzeigen →

Entdecken Sie die meistgenutzten Tools unserer Community.

Alle Tools erkunden

Durchsuchen Sie unsere Tool-Sammlung

Alle Tools anzeigen →
Teilen

Financial Contributors on Open Collective GitHub release CircleCI Go Report Card License: AGPL v3

Dockle - Container-Image-Linter für Sicherheit, Hilft beim Erstellen von Best-Practice-Docker-Images, einfacher Einstieg

Dockle hilft Ihnen:

  1. Erstellen von Best-Practice Docker-Images
  2. Erstellen sicherer Docker-Images
    • Prüfpunkte umfassen CIS Benchmarks```bash $ brew untap goodwithtech/dockle # who use 0.1.16 or older version $ brew install goodwithtech/r/dockle $ dockle [YOUR_IMAGE_NAME]
root@kitploit:~
Siehe [Installation](#installation) und [Häufige Beispiele](#common-examples)

<img src="https://assets.kitploit.com/production/public/readmes/4137/343598bd4d53296c6d6d23acde8c2917d5727f03e7b3a34c1ff0865c435bb974.png" width="800">

# Vergleich der Prüfpunkte

<img src="https://assets.kitploit.com/production/public/readmes/4137/4f4835c3a5fd70f436d9d8ea656fd8a521112fece4e35977288064d3f6f4510a.png" width="800">
<img src="https://assets.kitploit.com/production/public/readmes/4137/7bee9da0b061957af6a175a3b975dca82813c27f72ab6921dfe8ab2d6747322b.png" width="800">

# Inhaltsverzeichnis

- [Funktionen](#features)
- [Vergleich](#comparison)
- [Installation](#installation)
  - [Homebrew (Mac OS X / Linux und WSL)](#homebrew-mac-os-x--linux-and-wsl)
  - [RHEL/CentOS](#rhelcentos)
  - [Debian/Ubuntu](#debianubuntu)
  - [Arch Linux](#arch-linux)
  - [Windows](#windows)
  - [Microsoft PowerShell 7](#microsoft-powershell-7)
  - [Binärdatei](#binary)
  - [asdf](#asdf)
  - [mise](#mise)
  - [Aus dem Quellcode](#from-source)
  - [Docker verwenden](#use-docker)
- [Schnellstart](#quick-start)
  - [Grundlagen](#basic)
  - [Docker](#docker)
- [Zusammenfassung der Prüfpunkte](#checkpoint-summary)
- [Häufige Beispiele](#common-examples)
  - [Ein Image scannen](#scan-an-image)
  - [Eine Imagedatei scannen](#scan-an-image-file)
  - [Ergebnisse als JSON abrufen oder speichern](#get-or-save-the-results-as-json)
  - [Ergebnisse als SARIF abrufen oder speichern](#get-or-save-the-results-as-sarif)
  - [Exit-Code festlegen](#specify-exit-code)
  - [Exit-Level festlegen](#specify-exit-level)
  - [Bestimmte Prüfpunkte ignorieren](#ignore-the-specified-checkpoints)
  - [Verdächtige `Umgebungsvariablen` / `Dateien` / `Dateierweiterungen` akzeptieren](#accept-suspicious-environment-variables--files--file-extensions)
  - [Verdächtige `Umgebungsvariablen` / `Dateien` / `Dateierweiterungen` ablehnen](#reject-suspicious-environment-variables--files--file-extensions)
- [Kontinuierliche Integration](#continuous-integration-ci)
  - [GitHub Action](#github-action)
  - [Travis CI](#travis-ci)
  - [CircleCI](#circleci)
  - [GitLab CI](#gitlab-ci)
  - [Autorisierung für private Docker-Registry](#authorization-for-private-docker-registry)
    - [Docker Hub](#docker-hub)
    - [Amazon ECR (Elastic Container Registry)](#amazon-ecr-elastic-container-registry)
    - [GCR (Google Container Registry)](#gcr-google-container-registry)
    - [Selbst gehostete Registry (BasicAuth)](#self-hosted-registry-basicauth)
- [Mitwirkende](#contributors)
  - [Code-Mitwirkende](#code-contributors)
  - [Finanzielle Unterstützer](#financial-contributors)
    - [Einzelpersonen](#individuals)
    - [Organisationen](#organizations)
- [Lizenz](#license)
- [Autor](#author)

# Funktionen

- Container-Schwachstellen erkennen
- Hilft beim Erstellen von Best-Practice-Dockerfiles
- Einfache Verwendung
  - Nur den Image-Namen angeben
  - Siehe [Schnellstart](#quick-start) und [Häufige Beispiele](#common-examples)
- CIS-Benchmarks-Unterstützung
  - Hohe Genauigkeit
- DevSecOps
  - Geeignet für CI wie Travis CI, CircleCI, Jenkins usw.
  - Siehe [CI-Beispiel](#continuous-integration-ci)

# Vergleich

| | [Dockle](https://github.com/goodwithtech/dockle) | [Hadolint](https://github.com/hadolint/hadolint) | [Docker Bench for Security](https://github.com/docker/docker-bench-security) | [Clair](https://github.com/coreos/clair) |
|--- |---:|---:|---:|---:|
| Ziel | Image | Dockerfile | Host<br/>Docker-Daemon<br/>Image<br/>Container-Laufzeit | Image |
| Ausführung | Binärdatei | Binärdatei | Shell-Skript | Binärdatei |
| Abhängigkeiten | Nein | Nein | Einige Abhängigkeiten | Nein |
| CI-geeignet | ✓ | ✓ | x | x |
| Zweck | Sicherheitsaudit<br/>Dockerfile-Lint | Dockerfile-Lint | Sicherheitsaudit<br/>Dockerfile-Lint | Schwachstellen scannen |

# Installation

## Homebrew (Mac OS X / Linux und WSL)

Sie können Homebrew unter [Mac OS X](https://brew.sh/) oder [Linux und WSL (Windows-Subsystem für Linux)](https://docs.brew.sh/Homebrew-on-Linux) verwenden.```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

root@kitploit:~
## 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 kann aus dem Arch User Repository mit dem Paket dockle oder dockle-bin installiert werden.``` git clone https://aur.archlinux.org/dockle-bin.git cd dockle-bin makepkg -sri

root@kitploit:~
## 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(?[^"]+)"') { $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 }

root@kitploit:~
## Binärdatei

Sie können die neueste Binärversion von der [Releases-Seite](https://github.com/goodwithtech/dockle/releases/latest) herunterladen.

Laden Sie die Archivdatei für Ihr Betriebssystem/Ihre Architektur herunter. Entpacken Sie das Archiv und legen Sie die Binärdatei in Ihrem `$PATH` ab (auf UNIX-ähnlichen Systemen `/usr/local/bin` oder ähnlich).

- HINWEIS: Stellen Sie sicher, dass die Ausführungsbits gesetzt sind. (`chmod +x dockle`)

## asdf

Sie können dockle mit dem [asdf-Versionmanager](https://asdf-vm.com/) und diesem [Plugin](https://github.com/mathew-fleisch/asdf-dockle) installieren, das den Installationsprozess (und das Wechseln zwischen) verschiedener Versionen von GitHub-Release-Binärdateien automatisiert. Wenn asdf bereits installiert ist, führen Sie diese Befehle aus, um dockle zu installieren:```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

Sie können dockle mit mise installieren, dem polyglotten Tool-Versionsmanager. Wenn mise bereits installiert ist, führen Sie diese Befehle aus, um dockle zu installieren:```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

root@kitploit:~
## Aus dem Quellcode```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

Es gibt auch ein Dockle-Image auf Docker Hub. Sie können dockle ausprobieren, bevor Sie den Befehl installieren.``` $ 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]

root@kitploit:~
Sie benötigen `-v /var/run/docker.sock:/var/run/docker.sock` nur, wenn Sie das Image auf Ihrem Hostrechner scannen möchten.

# Schnellstart

## Einfach

Geben Sie einfach einen Image-Namen (und einen Tag) an.```bash
$ dockle [YOUR_IMAGE_NAME]
Ergebnis``` FATAL - CIS-DI-0009: Use COPY instead of ADD in Dockerfile * Use COPY : /bin/sh -c #(nop) ADD file:81c0a803075715d1a6b4f75a29f8a01b21cc170cfc1bff6702317d1be2fe71a3 in /app/credentials.json FATAL - CIS-DI-0010: Do not store credential in ENVIRONMENT vars/files * Suspicious filename found : app/credentials.json FATAL - DKL-DI-0005: Clear apt-get caches * Use 'rm -rf /var/lib/apt/lists' after 'apt-get install' : /bin/sh -c apt-get update && apt-get install -y git FATAL - DKL-LI-0001: Avoid empty password * No password user found! username : nopasswd WARN - CIS-DI-0001: Create a user for the container * Last user should not be root INFO - CIS-DI-0005: Enable Content trust for Docker * export DOCKER_CONTENT_TRUST=1 before docker pull/build INFO - CIS-DI-0008: Confirm safety of setuid/setgid files * setuid file: app/suid.txt urw-r--r-- * setgid file: app/gid.txt grw-r--r-- * setuid file: usr/bin/gpasswd urwxr-xr-x * setgid file: usr/bin/wall grwxr-xr-x * setuid file: bin/su urwxr-xr-x * setuid file: bin/umount urwxr-xr-x * setuid file: bin/mount urwxr-xr-x * setgid file: usr/bin/ssh-agent grwxr-xr-x * setuid file: etc/shadow urw-r----- * setuid file: usr/bin/chsh urwxr-xr-x * setuid file: usr/bin/chfn urwxr-xr-x * setuid file: usr/lib/openssh/ssh-keysign urwxr-xr-x * setgid file: etc/passwd grw-r--r-- * setgid file: sbin/unix_chkpwd grwxr-xr-x * setgid file: usr/bin/chage grwxr-xr-x * setuid file: usr/bin/passwd urwxr-xr-x * setgid file: usr/bin/expiry grwxr-xr-x * setuid file: usr/bin/newgrp urwxr-xr-x IGNORE - CIS-DI-0006: Add HEALTHCHECK instruction to the container image
root@kitploit:~
</details>

## Docker

Außerdem können Sie Docker verwenden, um den Befehl `dockle` wie folgt auszuführen.```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]
  • Wenn Sie das Image auf Ihrem Host-Rechner scannen möchten, müssen Sie docker.sock mounten.

    root@kitploit:~
    $ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ...
    

Checkpoint-Übersicht

  • Details zu jedem Checkpoint siehe CHECKPOINT.md

Level

LEVELDESCRIPTION
FATALPraktisch und umsichtig sein

Common Examples

Ein Image scannen

Einfach einen Image-Namen (und einen Tag) angeben.```bash $ dockle goodwithtech/test-image:v1

root@kitploit:~
<details>
<summary>Ergebnis</summary>```
FATAL   - CIS-DI-0001: Create a user for the container
        * Last user should not be root
WARN    - CIS-DI-0005: Enable Content trust for Docker
        * export DOCKER_CONTENT_TRUST=1 before docker pull/build
FATAL   - CIS-DI-0006: Add HEALTHCHECK instruction to the container image
        * not found HEALTHCHECK statement
FATAL   - CIS-DI-0007: Do not use update instructions alone in the Dockerfile
        * Use 'Always combine RUN 'apt-get update' with 'apt-get install' : /bin/sh -c apt-get update && apt-get install -y git
FATAL   - CIS-DI-0008: Remove setuid and setgid permissions in the images
        * Found setuid file: etc/passwd grw-r--r--
        * Found setuid file: usr/lib/openssh/ssh-keysign urwxr-xr-x
        * Found setuid file: app/hoge.txt ugrw-r--r--
        * Found setuid file: app/hoge.txt ugrw-r--r--
        * Found setuid file: etc/shadow urw-r-----
FATAL   - CIS-DI-0009: Use COPY instead of ADD in Dockerfile
        * Use COPY : /bin/sh -c #(nop) ADD file:81c0a803075715d1a6b4f75a29f8a01b21cc170cfc1bff6702317d1be2fe71a3 in /app/credentials.json
FATAL   - CIS-DI-0010: Do not store secrets in ENVIRONMENT variables
        * Suspicious ENV key found : MYSQL_PASSWD
FATAL   - CIS-DI-0010: Do not store secret files
        * Suspicious filename found : app/credentials.json
PASS    - DKL-DI-0001: Avoid sudo command
FATAL   - DKL-DI-0002: Avoid sensitive directory mounting
        * Avoid mounting sensitive dirs : /usr
PASS    - DKL-DI-0003: Avoid apt-get/apk/dist-upgrade
PASS    - DKL-DI-0004: Use apk add with --no-cache
FATAL   - DKL-DI-0005: Clear apt-get caches
        * Use 'apt-get clean && rm -rf /var/lib/apt/lists/*' : /bin/sh -c apt-get update && apt-get install -y git
PASS    - DKL-DI-0006: Avoid latest tag
FATAL   - DKL-LI-0001: Avoid empty password
        * No password user found! username : nopasswd
PASS    - DKL-LI-0002: Be unique UID
PASS    - DKL-LI-0002: Be unique GROUP

Eine Bilddatei scannen```bash

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

root@kitploit:~
### Ergebnisse als JSON abrufen oder speichern```bash
$ dockle -f json goodwithtech/test-image:v1
$ dockle -f json -o results.json goodwithtech/test-image:v1
Ergebnis```json { "summary": { "fatal": 6, "warn": 2, "info": 2, "pass": 7 }, "details": [ { "code": "CIS-DI-0001", "title": "Create a user for the container", "level": "WARN", "alerts": [ "Last user should not be root" ] }, { "code": "CIS-DI-0005", "title": "Enable Content trust for Docker", "level": "INFO", "alerts": [ "export DOCKER_CONTENT_TRUST=1 before docker pull/build" ] }, { "code": "CIS-DI-0006", "title": "Add HEALTHCHECK instruction to the container image", "level": "WARN", "alerts": [ "not found HEALTHCHECK statement" ] }, { "code": "CIS-DI-0008", "title": "Remove setuid and setgid permissions in the images", "level": "INFO", "alerts": [ "Found setuid file: usr/lib/openssh/ssh-keysign urwxr-xr-x" ] }, { "code": "CIS-DI-0009", "title": "Use COPY instead of ADD in Dockerfile", "level": "FATAL", "alerts": [ "Use COPY : /bin/sh -c #(nop) ADD file:81c0a803075715d1a6b4f75a29f8a01b21cc170cfc1bff6702317d1be2fe71a3 in /app/credentials.json " ] }, { "code": "CIS-DI-0010", "title": "Do not store secrets in ENVIRONMENT variables", "level": "FATAL", "alerts": [ "Suspicious ENV key found : MYSQL_PASSWD" ] }, { "code": "CIS-DI-0010", "title": "Do not store secret files", "level": "FATAL", "alerts": [ "Suspicious filename found : app/credentials.json " ] }, { "code": "DKL-DI-0002", "title": "Avoid sensitive directory mounting", "level": "FATAL", "alerts": [ "Avoid mounting sensitive dirs : /usr" ] }, { "code": "DKL-DI-0005", "title": "Clear apt-get caches", "level": "FATAL", "alerts": [ "Use 'rm -rf /var/lib/apt/lists' after 'apt-get install' : /bin/sh -c apt-get update \u0026\u0026 apt-get install -y git" ] }, { "code": "DKL-LI-0001", "title": "Avoid empty password", "level": "FATAL", "alerts": [ "No password user found! username : nopasswd" ] } ] } ```

Ergebnisse abrufen oder als SARIF speichern```bash

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

root@kitploit:~
<details>
<summary>Ergebnis</summary>```json
{
  "version": "2.1.0",
  "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
  "runs": [
    {
      "tool": {
        "driver": {
          "name": "Dockle",
          "informationUri": "https://github.com/goodwithtech/dockle",
          "rules": [
            {
              "id": "CIS-DI-0009",
              "shortDescription": {
                "text": "Use COPY instead of ADD in Dockerfile"
              },
              "help": {
                "text": "https://github.com/goodwithtech/dockle/blob/master/CHECKPOINT.md#CIS-DI-0009"
              }
            },
            {
              "id": "CIS-DI-0010",
              "shortDescription": {
                "text": "Do not store credential in ENVIRONMENT vars/files"
              },
              "help": {
                "text": "https://github.com/goodwithtech/dockle/blob/master/CHECKPOINT.md#CIS-DI-0010"
              }
            },
            {
              "id": "DKL-DI-0005",
              "shortDescription": {
                "text": "Clear apt-get caches"
              },
              "help": {
                "text": "https://github.com/goodwithtech/dockle/blob/master/CHECKPOINT.md#DKL-DI-0005"
              }
            },
            {
              "id": "DKL-LI-0001",
              "shortDescription": {
                "text": "Avoid empty password"
              },
              "help": {
                "text": "https://github.com/goodwithtech/dockle/blob/master/CHECKPOINT.md#DKL-LI-0001"
              }
            },
            {
              "id": "CIS-DI-0005",
              "shortDescription": {
                "text": "Enable Content trust for Docker"
              },
              "help": {
                "text": "https://github.com/goodwithtech/dockle/blob/master/CHECKPOINT.md#CIS-DI-0005"
              }
            },
            {
              "id": "CIS-DI-0008",
              "shortDescription": {
                "text": "Confirm safety of setuid/setgid files"
              },
              "help": {
                "text": "https://github.com/goodwithtech/dockle/blob/master/CHECKPOINT.md#CIS-DI-0008"
              }
            },
            {
              "id": "CIS-DI-0001",
              "shortDescription": {
                "text": "Create a user for the container"
              },
              "help": {
                "text": "https://github.com/goodwithtech/dockle/blob/master/CHECKPOINT.md#CIS-DI-0001"
              }
            },
            {
              "id": "CIS-DI-0006",
              "shortDescription": {
                "text": "Add HEALTHCHECK instruction to the container image"
              },
              "help": {
                "text": "https://github.com/goodwithtech/dockle/blob/master/CHECKPOINT.md#CIS-DI-0006"
              }
            }
          ]
        }
      },
      "results": [
        {
          "ruleId": "CIS-DI-0009",
          "level": "error",
          "message": {
            "text": "Use COPY : /bin/sh -c #(nop) ADD file:81c0a803075715d1a6b4f75a29f8a01b21cc170cfc1bff6702317d1be2fe71a3 in /app/credentials.json "
          }
        },
        {
          "ruleId": "CIS-DI-0010",
          "level": "error",
          "message": {
            "text": "Suspicious filename found : app/credentials.json , Suspicious ENV key found : MYSQL_PASSWD"
          }
        },
        {
          "ruleId": "DKL-DI-0005",
          "level": "error",
          "message": {
            "text": "Use 'rm -rf /var/lib/apt/lists' after 'apt-get install' : /bin/sh -c apt-get update \u0026\u0026 apt-get install -y git"
          }
        },
        {
          "ruleId": "DKL-LI-0001",
          "level": "error",
          "message": {
            "text": "No password user found! username : nopasswd"
          }
        },
        {
          "ruleId": "CIS-DI-0005",
          "level": "note",
          "message": {
            "text": "export DOCKER_CONTENT_TRUST=1 before docker pull/build"
          }
        },
        {
          "ruleId": "CIS-DI-0008",
          "level": "note",
          "message": {
            "text": "setuid file: urwxr-xr-x usr/bin/newgrp, setgid file: grwxr-xr-x usr/bin/ssh-agent, setgid file: grwxr-xr-x usr/bin/expiry, setuid file: urwxr-xr-x usr/lib/openssh/ssh-keysign, setuid file: urwxr-xr-x bin/umount, setgid file: grwxr-xr-x usr/bin/chage, setuid file: urwxr-xr-x usr/bin/passwd, setgid file: grwxr-xr-x sbin/unix_chkpwd, setuid file: urwxr-xr-x usr/bin/chsh, setgid file: grwxr-xr-x usr/bin/wall, setuid file: urwxr-xr-x bin/ping, setuid file: urwxr-xr-x bin/su, setuid file: urwxr-xr-x usr/bin/chfn, setuid file: urwxr-xr-x usr/bin/gpasswd, setuid file: urwxr-xr-x bin/mount"
          }
        },
        {
          "ruleId": "CIS-DI-0001",
          "level": "none",
          "message": {
            "text": "Last user should not be root"
          }
        },
        {
          "ruleId": "CIS-DI-0006",
          "level": "none",
          "message": {
            "text": "not found HEALTHCHECK statement"
          }
        }
      ]
    }
  ]
}

Exit-Code festlegen

Standardmäßig beendet sich Dockle mit dem Code 0, selbst wenn es Probleme gibt.

Verwenden Sie die Option --exit-code, -c, um mit einem Exit-Code ungleich Null zu beenden, falls eine WARN- oder FATAL-Warnung gefunden wurde.```bash $ dockle --exit-code 1 [IMAGE_NAME]

root@kitploit:~
### Specify exit level

Standardmäßig wird `--exit-code` ausgeführt, wenn Warnungen (`WARN`) oder schwerwiegende (`FATAL`) Alarme vorliegen.

Verwenden Sie die Option `--exit-level, -l`, um den Alarmlevel zu ändern. Sie können `info`, `warn` oder `fatal` festlegen.```bash
$ dockle --exit-code 1 --exit-level info [IMAGE_NAME]
$ dockle --exit-code 1 --exit-level fatal [IMAGE_NAME]

Angegebene Checkpoints ignorieren

Die Option --ignore, -i kann angegebene Checkpoints ignorieren.```bash $ dockle -i CIS-DI-0001 -i DKL-DI-0006 [IMAGE_NAME]

root@kitploit:~
Oder, verwenden Sie `DOCKLE_IGNORES`:```
export DOCKLE_IGNORES=CIS-DI-0001,DKL-DI-0006
dockle [IMAGE_NAME]

Oder, verwende die .dockleignore-Datei:```bash $ cat .dockleignore

set root to default user because we want to run nginx

CIS-DI-0001

Use latest tag because to check the image inside only

DKL-DI-0006

root@kitploit:~
### Akzeptiere verdächtige `Umgebungsvariablen` / `Dateien` / `Dateierweiterungen````bash
# --accept-key value, --ak value             You can add acceptable keywords.
dockle -ak GPG_KEY -ak KEYCLOAK_VERSION [IMAGE_NAME]
or DOCKLE_ACCEPT_KEYS=GPG_KEY,KEYCLOAK_VERSION dockle [IMAGE_NAME]

# --accept-file value, --af value            You can add acceptable file names.
dockle -af id_rsa -af id_dsa [IMAGE_NAME]
or DOCKLE_ACCEPT_FILES=id_rsa,id_dsa dockle [IMAGE_NAME]

# --accept-file-extension value, --ae value  You can add acceptable file extensions.
dockle -ae pem -ae log [IMAGE_NAME]
or DOCKLE_ACCEPT_FILE_EXTENSIONS=pem,log dockle [IMAGE_NAME]

Verdächtige environment variables / files / file extensions ablehnen```bash

--sensitive-word value, --sw value You can add acceptable keywords.

dockle -sw PRIVATE [IMAGE_NAME] or DOCKLE_ACCEPT_KEYS=GPG_KEY,KEYCLOAK_VERSION dockle [IMAGE_NAME]

--sensitive-file value, --sf value You can add acceptable file names.

dockle -sf .env [IMAGE_NAME] or DOCKLE_REJECT_FILES=.env dockle [IMAGE_NAME]

--sensitive-file-extension value, --se value You can add acceptable file extensions.

dockle -se pfx [IMAGE_NAME] or DOCKLE_REJECT_FILE_EXTENSIONS=pfx dockle [IMAGE_NAME]

root@kitploit:~
## Continuous Integration (CI)

Sie können Ihr erstelltes Image mit `Dockle` in Travis CI/CircleCI scannen.

In diesen Beispielen wird der Test fehlschlagen, wenn Warnungen gefunden werden.

Sie können jedoch die angegebenen Ziel-Prüfpunkte mit der `.dockleignore`-Datei ignorieren.

Oder, wenn Sie nur die Ergebnisse anzeigen möchten und den Test nicht fehlschlagen lassen möchten, geben Sie `--exit-code` auf `0` im `dockle`-Befehl an.

### GitHub Action

Wir bieten [goodwithtech/dockle-action](https://github.com/goodwithtech/dockle-action) an.```yaml
- uses: goodwithtech/dockle-action@main
  with:
    image: 'target'
    format: 'list'
    exit-code: '1'
    exit-level: 'warn'
    ignore: 'CIS-DI-0001,DKL-DI-0006'

Travis CI

.travis.yml```yaml services: - docker

env: global: - COMMIT=${TRAVIS_COMMIT::8}

before_install:

  • docker build -t dockle-ci-test:${COMMIT} .
  • export VERSION=$(curl --silent "https://api.github.com/repos/goodwithtech/dockle/releases/latest" | grep '"tag_name":' | sed -E 's/."v([^"]+)"./\1/')
  • wget https://github.com/goodwithtech/dockle/releases/download/v${VERSION}/dockle_${VERSION}_Linux-64bit.tar.gz
  • tar zxvf dockle_${VERSION}_Linux-64bit.tar.gz script:
  • ./dockle dockle-ci-test:${COMMIT}
  • ./dockle --exit-code 1 dockle-ci-test:${COMMIT}
root@kitploit:~
</details>

- Beispiel: https://travis-ci.org/goodwithtech/dockle-ci-test
- Repository: https://github.com/goodwithtech/dockle-ci-test

### CircleCI

<details>
<summary>.circleci/config.yml</summary>```yaml
jobs:
  build:
    docker:
      - image: docker:18.09-git
    steps:
      - checkout
      - setup_remote_docker
      - run:
          name: Build image
          command: docker build -t dockle-ci-test:${CIRCLE_SHA1} .
      - run:
          name: Install dockle
          command: |
            apk add --update curl
            VERSION=$(
                curl --silent "https://api.github.com/repos/goodwithtech/dockle/releases/latest" | \
                grep '"tag_name":' | \
                sed -E 's/.*"v([^"]+)".*/\1/'
            )
            wget https://github.com/goodwithtech/dockle/releases/download/v${VERSION}/dockle_${VERSION}_Linux-64bit.tar.gz
            tar zxvf dockle_${VERSION}_Linux-64bit.tar.gz
            mv dockle /usr/local/bin
      - run:
          name: Scan the local image with dockle
          command: dockle --exit-code 1 dockle-ci-test:${CIRCLE_SHA1}
workflows:
  version: 2
  release:
    jobs:
      - build
  • Beispiel: https://circleci.com/gh/goodwithtech/dockle-ci-test
  • Repository: https://github.com/goodwithtech/dockle-ci-test

GitLab CI

.gitlab-ci.yml```yaml image: docker:stable stages: - test

variables: DOCKER_HOST: tcp://docker:2375/ DOCKER_DRIVER: overlay2 services:

  • docker:dind

unit_test: stage: test before_script: - apk -Uuv add bash git curl tar sed grep script: - docker build -t dockle-ci-test:${CI_COMMIT_SHORT_SHA} . - | VERSION=$( curl --silent "https://api.github.com/repos/goodwithtech/dockle/releases/latest" |
grep '"tag_name":' |
sed -E 's/."v([^"]+)"./\1/'
) && curl -L -o dockle.tar.gz https://github.com/goodwithtech/dockle/releases/download/v${VERSION}/dockle_${VERSION}_Linux-64bit.tar.gz &&
tar zxvf dockle.tar.gz - ./dockle --exit-code 1 dockle-ci-test:${CI_COMMIT_SHORT_SHA}

root@kitploit:~
</details>

- Beispiel: https://gitlab.com/tomoyamachi/dockle-ci-test/-/jobs/238215077
- Repository: https://github.com/goodwithtech/dockle-ci-test

## Autorisierung für private Docker-Registrierung

`Dockle` kann Images aus einer privaten Registrierung herunterladen, ohne `Docker` oder andere Drittanbieter-Tools zu installieren. Es ist so konzipiert, dass es in einem CI-Prozess einfach zu verwenden ist.

Alles, was Sie tun müssen, ist: `Dockle` installieren und Umgebungsvariablen setzen.

- HINWEIS: Ich empfehle nicht, ENV-Variablen auf Ihrem lokalen Rechner zu verwenden.

### Docker Hub

Um das private Repository von Docker Hub herunterzuladen, müssen Sie die ENV-Variablen `DOCKLE_AUTH_URL`, `DOCKLE_USERNAME` und `DOCKLE_PASSWORD` setzen.```bash
export DOCKLE_AUTH_URL=https://registry.hub.docker.com
export DOCKLE_USERNAME={DOCKERHUB_USERNAME}
export DOCKLE_PASSWORD={DOCKERHUB_PASSWORD}
  • NOTE: Sie müssen keine Umgebungsvariablen setzen, wenn Sie aus dem öffentlichen Repository herunterladen.

Amazon ECR (Elastic Container Registry)

Dockle verwendet das AWS SDK. Sie müssen das aws CLI-Tool nicht installieren.

Verwenden Sie die Umgebungsvariablen der AWS CLI.```bash export AWS_ACCESS_KEY_ID={AWS ACCESS KEY} export AWS_SECRET_ACCESS_KEY={SECRET KEY} export AWS_DEFAULT_REGION={AWS REGION}

root@kitploit:~
### GCR (Google Container Registry)

`Dockle` verwendet das Google Cloud SDK. Daher müssen Sie den Befehl `gcloud` nicht installieren.

Wenn Sie das Repository des Zielprojekts verwenden möchten, können Sie es über `GOOGLE_APPLICATION_CREDENTIAL` einrichten.```bash
# must set DOCKLE_USERNAME empty char
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credential.json

Selbst gehostetes Registry (BasicAuth)

BasicAuth-Server benötigt DOCKLE_USERNAME und DOCKLE_PASSWORD.```bash export DOCKLE_USERNAME={USERNAME} export DOCKLE_PASSWORD={PASSWORD}

if you'd like to use 80 port, use NonSSL

export DOCKLE_NON_SSL=true

root@kitploit:~
## Mitwirkende

### Code-Mitwirkende

Dieses Projekt existiert dank aller Menschen, die beitragen. [[Beitragen](https://github.com/goodwithtech/dockle/blob/master/CONTRIBUTING.md)].
<a href="https://github.com/goodwithtech/dockle/graphs/contributors"><img src="https://opencollective.com/dockle/contributors.svg?width=890&amp;button=false" /></a>

### Finanzielle Mitwirkende

Werde ein finanzieller Mitwirkender und hilf uns, unsere Gemeinschaft zu erhalten. [[Beitragen](https://opencollective.com/dockle/contribute)]

#### Einzelpersonen

<a href="https://opencollective.com/dockle"><img src="https://opencollective.com/dockle/individuals.svg?width=890"></a>

#### Organisationen

Unterstütze dieses Projekt mit deiner Organisation. Dein Logo wird hier mit einem Link zu deiner Website angezeigt. [[Beitragen](https://opencollective.com/dockle/contribute)]

<a href="https://www.tines.com/?utm_source=oss&utm_medium=sponsorship&utm_campaign=dockle"><img src="https://assets.kitploit.com/production/public/readmes/4137/e063c5948228b346da42565b27ee62f2dd85648c0de86a2b184c7f111319d275.png"></a>
<a href="https://opencollective.com/dockle/organization/1/website"><img src="https://opencollective.com/dockle/organization/1/avatar.svg"></a>
<a href="https://opencollective.com/dockle/organization/2/website"><img src="https://opencollective.com/dockle/organization/2/avatar.svg"></a>
<a href="https://opencollective.com/dockle/organization/3/website"><img src="https://opencollective.com/dockle/organization/3/avatar.svg"></a>
<a href="https://opencollective.com/dockle/organization/4/website"><img src="https://opencollective.com/dockle/organization/4/avatar.svg"></a>
<a href="https://opencollective.com/dockle/organization/5/website"><img src="https://opencollective.com/dockle/organization/5/avatar.svg"></a>
<a href="https://opencollective.com/dockle/organization/6/website"><img src="https://opencollective.com/dockle/organization/6/avatar.svg"></a>
<a href="https://opencollective.com/dockle/organization/7/website"><img src="https://opencollective.com/dockle/organization/7/avatar.svg"></a>
<a href="https://opencollective.com/dockle/organization/8/website"><img src="https://opencollective.com/dockle/organization/8/avatar.svg"></a>
<a href="https://opencollective.com/dockle/organization/9/website"><img src="https://opencollective.com/dockle/organization/9/avatar.svg"></a>

### Unterstützer von OSS-Programmen

Dieses Projekt nutzt Dienste, die durch die folgenden OSS-Programme bereitgestellt werden.

<a href="https://flatt.tech/oss/gmo/trampoline" target="_blank"><img src="https://flatt.tech/assets/images/badges/gmo-oss.svg" height="24px"/></a>
<a href="https://github.com/1Password/for-open-source" target="_blank"><img src="https://img.shields.io/badge/1Password-OSS%20Program-0094F5?logo=1password&amp;logoColor=white" height="24px"/></a>

# Lizenz

- Apache License 2.0


# Autor

[@tomoyamachi](https://github.com/tomoyamachi) (Tomoya Amachi)

Besonderer Dank an [@knqyf263](https://github.com/knqyf263) (Teppei Fukuda) und [Trivy](https://github.com/knqyf263/trivy)
Tool herunterladen
CODEBESCHREIBUNGEBENE※
CIS's Docker Image Checkpoints
CIS-DI-0001Einen Benutzer für den Container erstellenWARN
CIS-DI-0002Vertrauenswürdige Basis-Images für Container verwendenFATAL
CIS-DI-0003Keine unnötigen Pakete im Container installierenFATAL
CIS-DI-0004Images scannen und neu erstellen, um Sicherheitsupdates einzubeziehenFATAL
CIS-DI-0005Content Trust für Docker aktivierenINFO
CIS-DI-0006HEALTHCHECK-Anweisung zum Container-Image hinzufügenINFO
CIS-DI-0007update-Anweisungen nicht allein in der Dockerfile verwendenFATAL
CIS-DI-0008Sicherheit von setuid- und setgid-Dateien bestätigenINFO
CIS-DI-0009COPY anstelle von ADD in der Dockerfile verwendenFATAL
CIS-DI-0010Keine Geheimnisse in Dockerfiles speichernFATAL
CIS-DI-0011Nur verifizierte Pakete installierenINFO
Dockle Checkpoints für Docker
DKL-DI-0001sudo-Befehl vermeidenFATAL
DKL-DI-0002Sensitives Verzeichnis-Mounting vermeidenFATAL
DKL-DI-0003apt-get dist-upgrade vermeidenWARN
DKL-DI-0004apk add mit --no-cache verwendenFATAL
DKL-DI-0005apt-get-Cache leerenFATAL
DKL-DI-0006latest-Tag vermeidenWARN
Dockle Checkpoints für Linux
DKL-LI-0001Leeres Passwort vermeidenFATAL
DKL-LI-0002Einzigartige UIDs/Gruppen sicherstellenFATAL
DKL-LI-0003Nur notwendige Dateien ablegenINFO
WARNPraktisch und umsichtig sein, aber eingeschränkte Verwendung (selbst bei offiziellen Images)
INFOKann Nutzen oder Leistung negativ beeinträchtigen
SKIPZieldateien nicht gefunden
PASSKeine Probleme gefunden