Skip to content

zypper-pin-versions

Dockerfilesuspiciousno fixdefault: offdockerfile/hadolint

Reports a zypper install (in) of a package without a version. A package is pinned when its name has =, < or > (curl=7.88.1) or when it is a .rpm file.

An unpinned install takes the newest version in the enabled repositories on the day of the build. Two builds of one Dockerfile can then differ, and a new release can break the image without any change in your code.

Pinned versions make the build repeatable. Repositories drop old versions, so a pin needs updating from time to time.

Reported
...
RUN dnf install -y curl-7.0 && dnf clean all
...
RUN zypper install curl
RUN zypper install -y curl=7.0 && zypper clean
RUN zypper install -y curl
...
RUN zypper -n in curl=1 && zypper cc
dockerfile:
lint:
rules:
zypper-pin-versions: warn # off (default), warn, error

Enabled by the presets: dockerfile/hadolint.

Suppress one line with sudsy-disable-next-line zypper-pin-versions in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
hadolint DL3037 full