DL3009: Allow either cache or tmpfs mounts#1123
Merged
m-ildefons merged 3 commits intohadolint:masterfrom Sep 11, 2025
Merged
Conversation
Allow apt cache and lists directories to be either cache or tmpfs mounts without warning. DL3009 warns if apt cache or list data is kept unnecessarily in the container image, as this increases the image size. There are several ways to avoid this: 1) remove the cache and lists directories after use, 2) mount a cache from the host to these directories and 3) mount a tmpfs from the host to the directories. This change modifies the DL3009 rule such that it won't trigger a warning if the a mount of type tmpfs is used for either the cache or lists directory. related-to: hadolint#1095 Signed-off-by: Moritz Röhrich <moritz@ildefons.de>
Member
Author
|
@detly would you like to review this? |
Allow cache and tmpfs mounts to avoid triggering rules DL3019, DL3060, DL3042, DL3040 For all package managers, the same applies: if the `RUN` instruction has a cache or tmpfs mount at the location where the package manager may keep its temporary files (caches, repo metadata etc.), then the rules warning about cache data being included in the container image should not trigger. related-to: hadolint#983 related-to: hadolint#497 Signed-off-by: Moritz Röhrich <moritz@ildefons.de>
- reduce duplication - remove unnecessary imports - remove unnecessary brackets and braces - eta reduce Signed-off-by: Moritz Röhrich <moritz@ildefons.de>
Thanks for asking! Sorry for the delay, I was on leave. I don't know Haskell, but I can confirm that the additional tests cover my own usage of it. |
Member
Author
|
👍 thanks. |
This was
linked to
issues
Sep 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow apt cache and lists directories to be either cache or tmpfs mounts without warning.
DL3009 warns if apt cache or list data is kept unnecessarily in the container image, as this increases the image size. There are several ways to avoid this: 1) remove the cache and lists directories after use, 2) mount a cache from the host to these directories and 3) mount a tmpfs from the host to the directories. This change modifies the DL3009 rule such that it won't trigger a warning if the a mount of type tmpfs is used for either the cache or lists directory.
related-to: #1095