mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-12 06:11:03 -04:00
27 lines
645 B
Go
27 lines
645 B
Go
package images // import "github.com/docker/docker/daemon/images"
|
|
|
|
import (
|
|
"github.com/docker/docker/builder"
|
|
"github.com/docker/docker/image/cache"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// MakeImageCache creates a stateful image cache.
|
|
func (i *ImageService) MakeImageCache(sourceRefs []string) builder.ImageCache {
|
|
if len(sourceRefs) == 0 {
|
|
return cache.NewLocal(i.imageStore)
|
|
}
|
|
|
|
cache := cache.New(i.imageStore)
|
|
|
|
for _, ref := range sourceRefs {
|
|
img, err := i.GetImage(ref)
|
|
if err != nil {
|
|
logrus.Warnf("Could not look up %s for cache resolution, skipping: %+v", ref, err)
|
|
continue
|
|
}
|
|
cache.Populate(img)
|
|
}
|
|
|
|
return cache
|
|
}
|