GeezerVison is showing github.com — Cache BuildKit state volume · Issue #122 · docker/setup-buildx-action
Cache BuildKit state volume #122Descriptionfollow-up docker/build-push-action#482
Since docker/buildx#672 BuildKit state is saved in a named volume. We should be able to cache it and mount it back. This would require the possiblity to name the builder instead of a generated one. Reacted by Paul Sanchez, Travis Cline, Jeff Bzdawka, Devminded, R Gibim, Charles Tison, Max Countryman, Miguel A. Alvarado V., Bruno Palermo, Artur Sinila and 22 more Activitybasicdays commented on Jan 18, 2022 This would be insanely awesome. Would this also cover the situation of not having to set cache-from and cache-to? My understanding is that image layer caching by default is kept in buildkit? tmc commented on Jan 19, 2022 This could be huge for speeding up larger or more complicated builds. crazy-max commented on Jan 19, 2022
This would be insanely awesome. Would this also cover the situation of not having to set cache-from and cache-to? My understanding is that image layer caching by default is kept in buildkit?
Yes cache exporter would not be required in this case. Note that this solution would only work with GitHub Actions and a defined builder as this is a the local state. Reacted by Paul Sanchez and berlin4apk Richard87 commented on Jan 19, 2022 Imagine of much compute resources would be saved if everyone building docker images on github saved 30sec each time 🤯 devminded commented on Jan 21, 2022 Richard87 commented on Jan 21, 2022 Thanks @devminded ! I remember I already do thos tings, uts jjust when I update a node dependency or PHP dependencies that everything takes forever 🤔 Drowze commented on Feb 17, 2022 This is very desired feature 😄
For our ruby applications, our Dockerfile look sorta like:
FROM alpine-ruby:latest
RUN mkdir /app
COPY Gemfile Gemfile.lock .ruby-version /app
RUN bundle install
COPY . /app
...so any change to our installed dependencies (described on Gemfile and Gemfile.lock) invalidates the layer that actually install the dependencies (bundle install), meaning we fetch and install all dependencies if a single dependency is changed.
I'm sure this is a very common scenario and, if it was possible to cache the dependencies directory in a docker volume and reuse that docker volume to build new images in between triggered pipelines, I'm sure the impact would be huge!
Very much looking forward to this 👍 crazy-max commented on Feb 17, 2022 Drowze commented on Feb 17, 2022 crazy-max commented on Feb 17, 2022
So using RUN --mount=type=cache will cache that mount in between builds using gha caching type? Even on GitHub managed runners (not self-hosted)? 🤔
No it will not export this cache (cache-to) but it will be cached to the buildkit state (volume). You can try it locally. wille commented on Dec 12, 2022 setup-buildx-action is unusable in larger builds because of the lack for buildkit state caching support ibalajiarun commented on Apr 19, 2023 I have this PR out to address this: #211 crazy-max commented on Apr 19, 2023
I have this PR out to address this: #211
Keeping BuildKit state will not work on public runners, hence #138 to try to address this. ibalajiarun commented on Apr 19, 2023 Yes, thats is true. Thanks for clarification. #211 will only work with persistent self-hosted runners. crohr commented on Jul 10, 2026 @crazy-max hello, what can we do to make this feature happen? would go hand in hand with #427.
Keeping BuildKit state will not work on public runners
A lot of runner providers now offer snapshotting / sticky disks, etc. Having a way to name the builder would be really nice so that we can do some magic around it (e.g. pre-create / re-hydrate the state volume before buildkit starts, stuff like that).
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|