Skip to content

DL3040 is triggered when cleaning the cache using 'rm' instead of 'dnf clean all' #796

@soenkeliebau

Description

@soenkeliebau
  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

Expected behavior

DL3040 should not throw a warning if the cache is cleaned by rm'ing the /var/cache/yum folder instead of a dnf clean all.

'rm -rf /var/cache/yum' actually might clean more than a dnf clean, as it will also clean cached data for disabled and orphaned repos. But this statement is based on research of about 3 minutes and should be confirmed by people with more knowledge than me.

Actual behavior

Hadolint warns about a missing clean all for the Dockerfile snippet given below.

Steps to reproduce the behavior

Create dockerfile with the below dnf snippet and run Hadolint against it.

Output of hadolint --version or
docker run --rm hadolint/hadolint hadolint --version or
docker run --rm ghcr.io/hadolint/hadolint hadolint --version:

This is run as a Github action with the ReviewDog Hadolint Action

Hadolint version: 2.8.0

uses reviewdog/action-hadolint@2f36e7ddb63420bac655b14287cb6d6b82dd84e2 

Dockerfile (if relevant)

...
# Update image
RUN dnf update --disablerepo=* --enablerepo=ubi-8-baseos --enablerepo=ubi-8-baseos -y \
  && rm -rf /var/cache/yum \
  && dnf install --disablerepo=* --enablerepo=ubi-8-baseos shadow-utils -y \
  && rm -rf /var/cache/yum
...

Additional environment details (OS, stack version, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions