gem-pin-versions
What it does
Section titled “What it does”Reports a gem install (or gem i) of a gem without a version: rails instead of rails:7.1.3. -v or --version pins as well. The values of options that take one (--source URL, -i DIR, --platform NAME) are not taken for gems.
Why it matters
Section titled “Why it matters”Without a version gem install takes the newest release on the day of the build, and so a major release of a gem can break the image, and two builds of one Dockerfile give different results.
Example
Section titled “Example”...RUN npm install ./local...RUN npm add express@4RUN gem install railsRUN gem install --no-document railsRUN gem install --source https://rubygems.org rails:7.0RUN gem install rails:7.0RUN gem install rails -v 7.0...Configuration
Section titled “Configuration”dockerfile: lint: rules: gem-pin-versions: warn # off (default), warn, errorEnabled by the presets: dockerfile/hadolint.
Suppress one line with sudsy-disable-next-line gem-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 | DL3028 |
partial | hadolint drops the word after every flag; Sudsy does the same (skip-flag-args: *), so cases it parses differently with options can differ. |