How can I apply cache to all layers in a builder with the docker-container driver in docker buildx build ? #2264
Unanswered
waveofmymind
asked this question in
Q&A
Replies: 1 comment
-
@waveofmymind Running into this issue myself with CUDA and buildx builders (on GitHub actions) too. did you ever figure out a solution? Seems created builders effectively have no cache. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
As the title suggests, after creating a buildx builder with --driver=docker-container, when using local cache, the build time differs from the default builder. (Here, the local cache is not the cache specified by the cache-from/cache-to options with type=local.)
Here is my Dockerfile.
I used the aforementioned Dockerfile and employed the default builder.
Additionally, the build command is as follows.
Using this method, the first build takes 391.8s, and the following log is produced.
When executing the second build consecutively, cache is applied to all layers, taking only 4s.
For the next case, to delete the previously processed data, I executed docker system prune -a and created a builder.
And then I proceed with the first build again. It took 391s
The next build took 381s.
I expected the build time to speed up from the first to the second build, similar to the results with the default builder, where local cache was used for all layers, but this did not happen.
Additionally, I tried using the --cache-from and --cache-to options with type=local to store and retrieve cache data in a local directory, but the build time did not decrease drastically as it did when using the default builder.
Is it impossible to use cache data for all layers like when using the default builder? Is there a need for additional settings?
The reason I want to use this method is because I plan to use the --cache-from/--cache-to options with the type=s3 option in the future.
If cache data exists in the builder volume, I want to use local cache to speed up the build, and if there is no cache data available, I want to apply cache using s3 data.
thank you.
Beta Was this translation helpful? Give feedback.
All reactions