Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
dockle — 보안을 위한 컨테이너 이미지 린터, 모범 사례 도커 이미지 구축 지원, 간편한 시작 | Kitploit
도구/GitHubGitHub/goodwithtech/dockle
Vulnerability ScannersContainer SecurityConfiguration AuditingDevSecOps
GitHubgoodwithtech/dockle

dockle

보안을 위한 컨테이너 이미지 린터, 모범 사례 도커 이미지 구축 지원, 간편한 시작

저장소 보기웹사이트
3.3k1661개월 전Kitploit 검토 완료

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

Open Collective의 재정 기여자 GitHub 릴리스 CircleCI Go Report Card 라이선스: AGPL v3

Dockle - 보안을 위한 컨테이너 이미지 린터, 모범 사례 Docker 이미지 구축 지원, 쉽게 시작하기

Dockle은 다음을 도와줍니다:

  1. 모범 사례 Docker 이미지 구축
  2. 안전한 Docker 이미지 구축
    • 검사 항목에는 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:~
참조: [설치](#installation) 및 [일반적인 예제](#common-examples)

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

# 체크포인트 비교

<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">

# 목차

- [기능](#features)
- [비교](#comparison)
- [설치](#installation)
  - [Homebrew (Mac OS X / Linux and 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)
  - [바이너리](#binary)
  - [asdf](#asdf)
  - [mise](#mise)
  - [소스에서](#from-source)
  - [Docker 사용](#use-docker)
- [빠른 시작](#quick-start)
  - [기본](#basic)
  - [Docker](#docker)
- [체크포인트 요약](#checkpoint-summary)
- [일반적인 예제](#common-examples)
  - [이미지 스캔](#scan-an-image)
  - [이미지 파일 스캔](#scan-an-image-file)
  - [결과를 JSON으로 가져오기 또는 저장하기](#get-or-save-the-results-as-json)
  - [결과를 SARIF로 가져오기 또는 저장하기](#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-ci)
  - [GitHub Action](#github-action)
  - [Travis CI](#travis-ci)
  - [CircleCI](#circleci)
  - [GitLab CI](#gitlab-ci)
  - [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)
    - [Self Hosted Registry (BasicAuth)](#self-hosted-registry-basicauth)
- [기여자](#contributors)
  - [코드 기여자](#code-contributors)
  - [재정 기여자](#financial-contributors)
    - [개인](#individuals)
    - [단체](#organizations)
- [라이선스](#license)
- [저자](#author)

# 기능

- 컨테이너의 취약점 감지
- 모범 사례 Dockerfile 구축 지원
- 간단한 사용법
  - 이미지 이름만 지정
  - [빠른 시작](#quick-start) 및 [일반적인 예제](#common-examples) 참조
- CIS 벤치마크 지원
  - 높은 정확도
- DevSecOps
  - Travis CI, CircleCI, Jenkins 등의 CI에 적합
  - [CI 예제](#continuous-integration-ci) 참조

# 비교

| | [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) |
|--- |---:|---:|---:|---:|
| 대상 |  이미지 | Dockerfile | 호스트<br/>Docker 데몬<br/>이미지<br/>컨테이너 런타임 | 이미지 |
| 실행 방법 | 바이너리 | 바이너리 | 쉘 스크립트 | 바이너리 |
| 의존성 | 없음 | 없음 | 일부 의존성 | 없음 |
| CI 적합 | ✓ | ✓ | x | x | 
| 목적 |보안 감사<br/>Dockerfile 린트| Dockerfile 린트 | 보안 감사<br/>Dockerfile 린트 | 취약점 스캔 |

# 설치

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

Homebrew를 [Mac OS X](https://brew.sh/) 또는 [Linux and WSL (Windows Subsystem for Linux)](https://docs.brew.sh/Homebrew-on-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

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은 Arch User Repository에서 dockle 또는 dockle-bin 패키지를 통해 설치할 수 있습니다.``` git clone https://aur.archlinux.org/dockle-bin.git cd dockle-bin makepkg -sri

root@kitploit:~
## 윈도우```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:~
## Binary

최신 버전 바이너리는 [릴리스 페이지](https://github.com/goodwithtech/dockle/releases/latest)에서 다운로드할 수 있습니다.

운영체제/아키텍처에 맞는 아카이브 파일을 다운로드하세요. 아카이브를 풀고 바이너리를 `$PATH`에 있는 디렉토리(UNIX 계열 시스템의 경우 `/usr/local/bin` 등)에 넣으세요.

- 참고: 실행 권한이 켜져 있는지 확인하세요. (`chmod +x dockle`)

## asdf

asdf 버전 관리자와 [이 플러그인](https://github.com/mathew-fleisch/asdf-dockle)을 사용하여 dockle을 설치할 수 있습니다. 이 플러그인은 다양한 버전의 GitHub 릴리스 바이너리 설치(및 전환) 과정을 자동화합니다. asdf가 이미 설치되어 있다면 다음 명령어를 실행하여 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

dockle을 mise (다국어 툴 버전 관리자)로 설치할 수 있습니다. mise가 이미 설치되어 있다면, 다음 명령어를 실행하여 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

root@kitploit:~
## 소스에서```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

Docker 사용하기

또한 Docker Hub에 Dockle 이미지가 있습니다. 명령어를 설치하기 전에 dockle을 사용해볼 수 있습니다.``` $ 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:~
호스트 머신에서 이미지를 스캔하려는 경우에만 `-v /var/run/docker.sock:/var/run/docker.sock`이 필요합니다.

# 빠른 시작

## 기본

간단히 이미지 이름(및 태그)을 지정하세요.```bash
$ dockle [YOUR_IMAGE_NAME]
결과``` 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

또한, Docker를 사용하여 `dockle` 명령어를 다음과 같이 사용할 수 있습니다.```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]
  • 호스트 머신에서 이미지를 스캔하려면 docker.sock을 마운트해야 합니다.

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

이미지 파일 스캔```bash

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

root@kitploit:~
### 결과를 JSON으로 가져오기 또는 저장하기```bash
$ dockle -f json goodwithtech/test-image:v1
$ dockle -f json -o results.json goodwithtech/test-image:v1
결과```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" ] } ] } ```

결과를 SARIF로 가져오거나 저장하기```bash

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

root@kitploit:~
<details>
<summary>결과</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"
          }
        }
      ]
    }
  ]
}

종료 코드 지정

기본적으로 Dockle은 문제가 있더라도 코드 0으로 종료됩니다.

WARN 또는 FATAL 경고가 발견된 경우 0이 아닌 종료 코드로 종료하려면 --exit-code, -c 옵션을 사용하세요.```bash $ dockle --exit-code 1 [IMAGE_NAME]

root@kitploit:~
### 종료 수준 지정

기본적으로 `--exit-code`는 `WARN` 또는 `FATAL` 수준의 알림이 있을 때 실행됩니다.

`--exit-level, -l` 옵션을 사용하여 알림 수준을 변경하세요. `info`, `warn` 또는 `fatal`로 설정할 수 있습니다.```bash
$ dockle --exit-code 1 --exit-level info [IMAGE_NAME]
$ dockle --exit-code 1 --exit-level fatal [IMAGE_NAME]

지정된 체크포인트 무시

--ignore, -i 옵션은 지정된 체크포인트를 무시할 수 있습니다.```bash $ dockle -i CIS-DI-0001 -i DKL-DI-0006 [IMAGE_NAME]

root@kitploit:~
또는 `DOCKLE_IGNORES`를 사용하세요:```
export DOCKLE_IGNORES=CIS-DI-0001,DKL-DI-0006
dockle [IMAGE_NAME]

또는 .dockleignore 파일을 사용하세요:```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:~
### 의심스러운 `environment variables` / `files` / `file extensions` 허용```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]

의심스러운 environment variables / files / file extensions 거부```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:~
## 지속적 통합 (CI)

Travis CI/CircleCI에서 `Dockle`로 빌드된 이미지를 스캔할 수 있습니다.

이 예제에서는 경고가 발견되면 테스트가 실패합니다.

하지만 `.dockleignore` 파일을 사용하여 특정 대상 체크포인트를 무시할 수 있습니다.

또는 결과만 표시하고 테스트가 실패하지 않게 하려면 `dockle` 명령에서 `--exit-code`를 `0`으로 지정하세요.

### GitHub Action

저희는 [goodwithtech/dockle-action](https://github.com/goodwithtech/dockle-action)을 제공합니다.```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>

- 예시: https://travis-ci.org/goodwithtech/dockle-ci-test
- 저장소: 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
  • 예시: https://circleci.com/gh/goodwithtech/dockle-ci-test
  • 저장소: 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>

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

## 개인 Docker 레지스트리 인증

`Dockle`는 `Docker`나 다른 타사 도구를 설치하지 않고 개인 레지스트리에서 이미지를 다운로드할 수 있습니다. CI 프로세스에서 사용하기 쉽도록 설계되었습니다.

해야 할 일은 `Dockle`을 설치하고 환경 변수를 설정하는 것뿐입니다.

- 참고: 로컬 머신에서 환경 변수를 사용하는 것은 권장하지 않습니다.

### Docker Hub

Docker Hub에서 개인 저장소를 다운로드하려면 `DOCKLE_AUTH_URL`, `DOCKLE_USERNAME`, `DOCKLE_PASSWORD` 환경 변수를 설정해야 합니다.```bash
export DOCKLE_AUTH_URL=https://registry.hub.docker.com
export DOCKLE_USERNAME={DOCKERHUB_USERNAME}
export DOCKLE_PASSWORD={DOCKERHUB_PASSWORD}
  • NOTE: 공용 리포지토리에서 다운로드할 때 ENV 변수를 설정할 필요가 없습니다.

Amazon ECR (Elastic Container Registry)

Dockle은 AWS SDK를 사용합니다. CLI 도구를 설치할 필요가 없습니다.

도구 다운로드

체크포인트 요약

  • 각 체크포인트에 대한 자세한 내용은 CHECKPOINT.md를 참조하세요.
코드설명레벨※
CIS Docker 이미지 체크포인트
CIS-DI-0001컨테이너 사용자 생성WARN
CIS-DI-0002신뢰할 수 있는 베이스 이미지 사용FATAL
CIS-DI-0003컨테이너에 불필요한 패키지 설치 금지FATAL
CIS-DI-0004이미지 스캔 및 재빌드하여 보안 패치 포함FATAL
CIS-DI-0005Docker 콘텐츠 신뢰 활성화INFO
CIS-DI-0006컨테이너 이미지에 HEALTHCHECK 명령 추가INFO
CIS-DI-0007Dockerfile에서 update 명령 단독 사용 금지FATAL
CIS-DI-0008setuid 및 setgid 파일의 안전성 확인INFO
CIS-DI-0009Dockerfile에서 ADD 대신 COPY 사용FATAL
CIS-DI-0010Dockerfile에 시크릿 저장 금지FATAL
CIS-DI-0011

레벨

Dockle는 5가지 점검 레벨을 가지고 있습니다.

레벨설명
FATAL실용적이고 신중하게
WARN실용적이고 신중하지만 제한적으로 사용 (공식 이미지인 경우에도)
INFO유틸리티나 성능을 저하시킬 수 있음
SKIP대상 파일을 찾을 수 없음
PASS문제 발견되지 않음

일반적인 예시

이미지 스캔하기

간단히 이미지 이름(및 태그)를 지정합니다.```bash $ dockle goodwithtech/test-image:v1

root@kitploit:~
<details>
<summary>결과</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
aws

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 컨테이너 레지스트리)

`Dockle`는 Google Cloud SDK를 사용합니다. 따라서 `gcloud` 명령어를 설치할 필요가 없습니다.

대상 프로젝트의 저장소를 사용하려면 `GOOGLE_APPLICATION_CREDENTIAL`을 통해 설정할 수 있습니다.```bash
# must set DOCKLE_USERNAME empty char
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credential.json

자가 호스팅 레지스트리 (BasicAuth)

BasicAuth 서버는 DOCKLE_USERNAME 및 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:~
## 기여자

### 코드 기여자

이 프로젝트는 기여해 주신 모든 분들 덕분에 존재합니다. [[기여하기](https://github.com/goodwithtech/dockle/blob/HEAD/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>

### 재정 기여자

재정 기여자가 되어 커뮤니티 유지에 도움을 주세요. [[기여하기](https://opencollective.com/dockle/contribute)]

#### 개인

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

#### 조직

조직과 함께 이 프로젝트를 지원하세요. 귀하의 로고가 웹사이트 링크와 함께 여기에 표시됩니다. [[기여하기](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>

### OSS 프로그램 후원자

이 프로젝트는 다음 OSS 프로그램을 통해 제공되는 서비스를 사용합니다.

<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>

# 라이선스

- Apache License 2.0

# 저자

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

특별 감사: [@knqyf263](https://github.com/knqyf263) (Teppei Fukuda) 님과 [Trivy](https://github.com/knqyf263/trivy)
검증된 패키지만 설치
INFO
Docker용 Dockle 체크포인트
DKL-DI-0001sudo 명령 사용 금지FATAL
DKL-DI-0002민감한 디렉토리 마운트 금지FATAL
DKL-DI-0003apt-get dist-upgrade 사용 금지WARN
DKL-DI-0004--no-cache와 함께 apk add 사용FATAL
DKL-DI-0005apt-get 캐시 정리FATAL
DKL-DI-0006latest 태그 사용 금지WARN
Linux용 Dockle 체크포인트
DKL-LI-0001빈 비밀번호 사용 금지FATAL
DKL-LI-0002고유한 UID/GROUP 사용FATAL
DKL-LI-0003필요한 파일만 포함INFO