You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today disabling cache can only be done with --no-cache. This is a proposal for adding --no-cache-filter to disable cache per target (aka Dockerfile stage) and per cache mount.
UX
Couple of examples to get a grasp:
--no-cache-filter target1,target2 invalidates cache for both targets target1 and target2 (most common usecase)
equivalent to --no-cache-filter target1 --no-cache-filter target2
--no-cache --no-cache-filter !target1,!target2 invalidates cache for all targets but target1 and target2 (less common usecase)
--no-cache-filter mount:id1 invalidates cache for the cache mount with id id1 (defined with RUN --mount=type=cache,id=id1,...)
--no-cache would keep current behavior of disabling cache for all targets and cache mounts
Implementation
We need a new ignoreCacheMounts LLB property in addition to ignoreCache. It would be an array of mount indices corresponding to cache mounts that would be ignored/reset. This would revert the behavior of ignoreCache to what it was prior to #1092 but changing the --no-cache implementation to use both ignoreCache and ignoreCacheMounts to keep the current behavior of --no-cache wrt cache mounts.
In this case --no-cache-filter mount:id1 is mount:id1 the equivalent of target1 and so would you be able to specify --no-cache --no-cache-filter !mount:id1 (essentially the negation on the mount) which essentially would disable all caches except id1 (I think this would provide my original use case around pip package caches) and would be a really helpful improvement.
Today disabling cache can only be done with
--no-cache
. This is a proposal for adding--no-cache-filter
to disable cache per target (aka Dockerfile stage) and per cache mount.UX
Couple of examples to get a grasp:
--no-cache-filter target1,target2
invalidates cache for both targetstarget1
andtarget2
(most common usecase)--no-cache-filter target1 --no-cache-filter target2
--no-cache --no-cache-filter !target1,!target2
invalidates cache for all targets buttarget1
andtarget2
(less common usecase)--no-cache-filter mount:id1
invalidates cache for the cache mount with idid1
(defined withRUN --mount=type=cache,id=id1,...
)--no-cache
would keep current behavior of disabling cache for all targets and cache mountsImplementation
We need a new
ignoreCacheMounts
LLB property in addition toignoreCache
. It would be an array of mount indices corresponding to cache mounts that would be ignored/reset. This would revert the behavior of ignoreCache to what it was prior to #1092 but changing the--no-cache
implementation to use bothignoreCache
andignoreCacheMounts
to keep the current behavior of--no-cache
wrt cache mounts.cc @tonistiigi @AkihiroSuda @FernandoMiguel
The text was updated successfully, but these errors were encountered: