Open asottile opened 6 years ago
Looks like this was discussed in https://github.com/moby/moby/issues/33002#issuecomment-299041162, and https://github.com/moby/moby/issues/33002, and https://github.com/moby/moby/issues/32612#issuecomment-294052399
ping @tonistiigi
Hey this would be a great feature. I have a environment where users use pull requests to get things into mainline. This means we create a new tag for each branch (and build number) like so.
PR-1 = user/imagename:PR-1
and the master branch will push to
master = user/imagename:latest
Right now we have --cache-from=user/imagename:latest on all nodes but because the tag from the branch is pushed to PR-1. The PR-1 image does not get used as a cache source for the master build. Right now to get this to work, I'd have to determine which PR was merged into the master branch or find a way to list all PR's as cache sources. It would be much simpler if I could just say --cache-from=user/imagename:* .
@Spenser309 you can probably replicate that today with:
docker images --filter reference=user/imagename --format='{{.ID}}'
@asottile ,
That seems to be just listing my local images. PR-1 may be built on a different machine than master. I'd like to be able to use the remote PR-1 image build as a cache.
Yeah, you'd have to docker pull
the targets first
Wanted to get some thoughts on this idea before actually implementing anything.
In a CI environment, it's useful to use
--cache-from
to select a set of images to consider for caching (that are pulled and not necessarily built on the box).For usage with an internal registry, I might use something like this as a wrapper to
docker build
:This effectively expands to:
While this is workable, it's a bit low on the quality-of-life scale.
I'm proposing an interface similar to this:
This would consider all images tagged with
my-registry.com/*
as part of the trusted cache set (without having to manually enumerate them myself).Thoughts?