Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False Negatives of rules related to package manager cache clearing #957

Open
1 of 3 tasks
Amaindex opened this issue May 17, 2023 · 0 comments · May be fixed by #962
Open
1 of 3 tasks

False Negatives of rules related to package manager cache clearing #957

Amaindex opened this issue May 17, 2023 · 0 comments · May be fixed by #962

Comments

@Amaindex
Copy link

Amaindex commented May 17, 2023

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

Expected behavior

After installing software using a package manager in the RUN command, developers should clear the cache to avoid unnecessary image sizes. The following rules all involve this logic:

  • DL3032: yum clean all missing after yum command.
  • DL3036: zypper clean missing after zypper use.
  • DL3040: dnf clean all missing after dnf command.
  • DL3060: yarn cache clean missing after yarn install was run.
  • etc.

Actual behavior

However, when there is a cache clearing action before the installation action in the same RUN command, the detection of these rules will present False Negative.

Steps to reproduce the behavior

Just prepare the following Dockerfile and apply Hadolint on it.

From CentOS:7.0
RUN yum clean all && yum install -y git-2.0

There is no output, even though it violates DL3032.

Output of hadolint --version

Haskell Dockerfile Linter 2.12.1

The relevant Dockerfile
There is a real-world Dockerfile here that can attest to this issue.

@matmarczak matmarczak linked a pull request Jun 14, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant