generic.dockerfile.best-practice.avoid-dnf-update.avoid-dnf-update

Author
2,919
Download Count*
License
Packages in base images should be up-to-date, removing the need for 'dnf update'. If packages are out-of-date, consider contacting the base image maintainer.
Run Locally
Run in CI
Defintion
rules:
- id: avoid-dnf-update
severity: INFO
languages:
- generic
message: Packages in base images should be up-to-date, removing the need for
'dnf update'. If packages are out-of-date, consider contacting the base
image maintainer.
metadata:
source-rule-url: https://github.com/hadolint/hadolint/wiki/DL3039
references:
- https://github.com/hadolint/hadolint/wiki/DL3039
category: best-practice
technology:
- dockerfile
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
paths:
include:
- "*dockerfile*"
- "*Dockerfile*"
pattern: dnf update
Examples
avoid-dnf-update.dockerfile
# cf. https://github.com/hadolint/hadolint/wiki/DL3039
FROM centos
# ruleid: avoid-dnf-update
RUN dnf update \
&& dnf install foo-1.0 \
&& dnf clean all
# ok: avoid-dnf-update
RUN dnf install foo=1.0:
Short Link: https://sg.run/Bkz7