이 제품은 선택한 Datadog 사이트에서 지원되지 않습니다. ().
이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.

Metadata

Id: dockerfile-apt-get-not-avoiding-additional-packages

Platform: Dockerfile

Severity: Low

Category: Supply-Chain

Learn More

Description

Dockerfile RUN instructions that invoke apt-get install should disable installation of recommended packages to reduce the image attack surface. Avoiding unnecessary package bloat decreases maintenance burden and potential vulnerabilities.

This check looks at RUN commands (both shell/string form and exec/array form) that call apt-get with install and requires either the --no-install-recommends option or the APT configuration apt::install-recommends set to false. Resources where the install command does not include --no-install-recommends and does not set apt::install-recommends to false will be flagged.

Secure examples:

# shell form
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && rm -rf /var/lib/apt/lists/*

# exec/array form
RUN ["apt-get", "update"]
RUN ["apt-get", "install", "-y", "--no-install-recommends", "ca-certificates", "curl"]

Compliant Code Examples

FROM node:12
RUN apt-get --no-install-recommends install apt-utils
RUN ["apt-get", "apt::install-recommends=false", "install", "apt-utils"]

Non-Compliant Code Examples

FROM node:12
RUN apt-get install apt-utils
RUN ["apt-get", "install", "apt-utils"]