Skip to main content

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