option to pull down required images from to the cache, so that build… #4149
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.
…kit never gets them over the network
- What I did
When you run
lkt pkg build, it an image from aFROMline in the Dockerfile already is in the cache, then lkt points buildkit to the local copy, rather than having it pull from the remote. This has existed for a long time, to serve two purposes:In addition, you always could do
lkt cache pullto pull an image, if you wanted. If you did that beforepkg build, then a referenced image would be read from local cache.This PR combines those two.
When
lkt pkg buildparses a Dockerfile right before passing it to buildkit, if it finds a reference that is not in the local cache, and the new--pre-cache-imagesoption is set, then lkt will pull down the image to local cache. This means a larger cache, but more importantly, it means that buildkit always will read images just from local cache.This can have an impact on network and registry usage. But it also lets you configure mirrors and such (see #4148) through the
lktclient, without needing to configure buildkit specially.- How I did it
pkg build- How to verify it
CI
- Description for the changelog
support for pre-caching images before pkg build