Skip to content
Moritz Röhrich edited this page Nov 6, 2020 · 1 revision

dnf clean all missing after dnf command.

Problematic code:

RUN dnf install -y httpd-2.24.2

Correct code:

RUN dnf install -y httpd-2.24.2 && dnf clean all

Rationale:

Clean cached package data after installation to reduce image size.

https://docs.docker.com/engine/articles/dockerfile_best-practices/

Notes:

Clean up must be performed in the same RUN step, otherwise it will not affect image size.