DL3059: Multiple consecutive RUN instructions
Info Efficiency
Why This Matters
Each RUN instruction creates a new image layer. Consecutive RUN instructions that could be combined into a single RUN with && waste space because files created in one layer and deleted in the next still exist in the earlier layer. This inflates image size and slows down container startup across your cluster.
How to Fix
Combine consecutive RUN instructions with &&
Before (incorrect)
RUN apt-get update
RUN apt-get install -y curl After (correct)
RUN apt-get update && \
apt-get install -y curl Rule Details
- Rule Code
- DL3059
- Severity
- Info
- Category
- Efficiency
Related Rules
DL3014 Warning
Use the -y switch for apt-get install
DL3003 Warning
Use WORKDIR to switch directories
DL4006 Warning
Set the SHELL option -o pipefail before RUN with a pipe in
DL3042 Warning
Avoid use of cache directory with pip
DL3015 Info
Avoid additional packages by specifying --no-install-recommends