1 DL3040
Moritz Röhrich edited this page 2020-11-06 20:16:29 +01:00

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.