Skip to content

Dockerfile rules

Command join

dockerfile

Commands in a Dockerfile should be joined together to reduce the number of layers in the resulting image.

Before

RUN apt-get update
RUN apt-get install -y curl

After

RUN apt-get update && \
  apt-get install -y curl

Missing yes flag

dockerfile dockerfile dockerfile dockerfile dockerfile dockerfile dockerfile

Installing a package in a Dockerfile needs a confirmation flag to avoid interactive prompts.

Before

RUN apt-get install curl

After

RUN apt-get install -y curl