1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon/cache.go
John Howard ba40132366 LCOW: Fix ImageCache to address right store
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-06-20 19:49:53 -07:00

27 lines
659 B
Go

package daemon
import (
"github.com/Sirupsen/logrus"
"github.com/docker/docker/builder"
"github.com/docker/docker/image/cache"
)
// MakeImageCache creates a stateful image cache.
func (daemon *Daemon) MakeImageCache(sourceRefs []string, platform string) builder.ImageCache {
if len(sourceRefs) == 0 {
return cache.NewLocal(daemon.stores[platform].imageStore)
}
cache := cache.New(daemon.stores[platform].imageStore)
for _, ref := range sourceRefs {
img, err := daemon.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
}