1 DL3037
Moritz Röhrich edited this page 2020-10-21 23:14:46 +02:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 whats 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.