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

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

Problematic code:

RUN yum install -y httpd && yum clean all

Correct code:

RUN yum install -y httpd-2.24.2 && yum 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 yum downgrade -y <package_name>-<version_info>