apt-get-pin-versions
What it does
Section titled “What it does”Reports an apt-get install of a package without a version. A package is pinned when its name has = (curl=7.88.1-10) or / (curl/stable, a release), or when it is a .deb file. The value of -t or --target-release is not taken for a package. A variable such as $PKGS counts as unpinned.
Why it matters
Section titled “Why it matters”An unpinned install takes the newest version the distribution offers 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. Debian and Ubuntu remove old versions from their repositories, so a pin stops resolving after a while and needs updating.
Example
Section titled “Example”FROM debian:12RUN apt-get update && apt-get install curl...RUN apt-get install -y --no-install-recommends curl...RUN apt-get install --yes \ curl \ gitRUN apt-get update...Configuration
Section titled “Configuration”dockerfile: lint: rules: apt-get-pin-versions: warn # off (default), warn, errorEnabled by the presets: dockerfile/hadolint.
Suppress one line with sudsy-disable-next-line apt-get-pin-versions in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| hadolint | DL3008 |
full |