Skip to main content

DL3015: Avoid additional packages by specifying --no-install-recommends

Info Efficiency

Why This Matters

By default, apt-get install pulls in "recommended" packages that are not strictly required. These extras can increase image size by 30-50% and expand the attack surface with unnecessary binaries. Use --no-install-recommends to install only the dependencies you actually need.

How to Fix

Add --no-install-recommends to apt-get install

Before (incorrect)

RUN apt-get install -y curl wget

After (correct)

RUN apt-get install -y --no-install-recommends curl wget

Rule Details

Rule Code
DL3015
Severity
Info
Category
Efficiency

Related Rules