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

Specify version with dnf install -y <package>-<version>

Problematic code:

RUN dnf install -y httpd && dnf clean all

Correct code:

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

Rationale:

Version pinning forces the build to retrieve a particular version regardless of what’s in the cache. This technique can also reduce failures due to unanticipated changes in required packages.

https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

Notes:

If you need downgrade an already installed package to an older version, use dnf downgrade -y <package_name>-<version_info>

Clone this wiki locally