
보안을 위한 컨테이너 이미지 린터, 모범 사례 도커 이미지 구축 지원, 간편한 시작
Dockle - 보안을 위한 컨테이너 이미지 린터, 모범 사례 Docker 이미지 구축 지원, 쉽게 시작하기
Dockle은 다음을 도와줍니다:
참조: [설치](#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
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
dockle은 Arch User Repository에서 dockle 또는 dockle-bin 패키지를 통해 설치할 수 있습니다.```
git clone https://aur.archlinux.org/dockle-bin.git
cd dockle-bin
makepkg -sri
## 윈도우```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]
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 }
## 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
dockle을 mise (다국어 툴 버전 관리자)로 설치할 수 있습니다. mise가 이미 설치되어 있다면, 다음 명령어를 실행하여 dockle을 설치하세요:```bash
mise ls-remote dockle
mise install dockle@latest
mise use -g dockle@latest
dockle --version
## 소스에서```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 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]
호스트 머신에서 이미지를 스캔하려는 경우에만 `-v /var/run/docker.sock:/var/run/docker.sock`이 필요합니다.
# 빠른 시작
## 기본