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

Specify version with zypper install -y <package>[=]<version>

Problematic code:

FROM opensuse/leap:15.2
RUN zypper install -y httpd && zypper clean

Correct code:

FROM opensuse/leap:15.2
RUN zypper install -y httpd=2.4.46 && zypper clean

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:

Zypper also supports version constraining:

RUN zypper install -y httpd\>=2.4 && zypper clean

Use this to specify minimum version requirements.

Clone this wiki locally