rpm-pin-versions
What it does
Section titled “What it does”Reports a yum install, dnf install or microdnf install of a package without a version. A package is pinned when it is written name-version (curl-7.88.1: a digit after a dash), is a .rpm file or contains a variable. Commands with module or group are not checked.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”FROM fedora:40RUN yum install curlRUN yum install -y curl-7.0 && yum clean allRUN yum install -y curl-7.0 && rm -rf /var/cache/yum/*RUN yum install -y nginx-1.2 && yum clean allRUN dnf install curl...RUN dnf install -y curl-7.0 && dnf clean all...RUN dnf install -y ./a.rpm && dnf clean all...RUN zypper install -y curl=7.0 && zypper clean...Configuration
Section titled “Configuration”dockerfile: lint: rules: rpm-pin-versions: warn # off (default), warn, errorEnabled by the presets: dockerfile/hadolint.
Suppress one line with sudsy-disable-next-line rpm-pin-versions in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| hadolint | DL3033 |
partial | A variable in a package counts as pinned; hadolint checks that an ENV or ARG defines it. |
| hadolint | DL3041 |
partial | A variable in a package counts as pinned; hadolint checks that an ENV or ARG defines it. |