drone-docker icon indicating copy to clipboard operation
drone-docker copied to clipboard

With Buildkit, don't pull docker images needlessly.

Open neil-ach opened this issue 3 years ago • 3 comments

When using Docker with Buildkit and inline cache information enabled, docker build will pull image layers to use as cache on demand. As a result, unconditionally pulling the cache is both superfluous and slower, so let's not do that.

neil-ach avatar Apr 07 '22 00:04 neil-ach

I would, but the suggested changes do not produce the desired behaviour. There is no situation where removing the cache-from argument does what we want, and that is what the suggested changes do. Please let me know if there's something from my previous comment that isn't clear about this, or if you have a different suggestion.

neil-ach avatar Jun 10 '22 22:06 neil-ach

the code in my comment is pseudo code, so please feel free to adjust the logic as needed. The request is to break out into a helper function to improve readability (bonus points for adding a unit test) to help make the code easier to understand.

bradrydzewski avatar Jun 10 '22 22:06 bradrydzewski

Sure, I can move the pre-pull determination into a helper function.

neil-ach avatar Jun 10 '22 22:06 neil-ach