mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
ce8e529e18
Signed-off-by: John Howard <jhoward@microsoft.com> The re-coalesces the daemon stores which were split as part of the original LCOW implementation. This is part of the work discussed in https://github.com/moby/moby/issues/34617, in particular see the document linked to in that issue.
27 lines
608 B
Go
27 lines
608 B
Go
package daemon
|
|
|
|
import (
|
|
"github.com/docker/docker/builder"
|
|
"github.com/docker/docker/image/cache"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// MakeImageCache creates a stateful image cache.
|
|
func (daemon *Daemon) MakeImageCache(sourceRefs []string) builder.ImageCache {
|
|
if len(sourceRefs) == 0 {
|
|
return cache.NewLocal(daemon.imageStore)
|
|
}
|
|
|
|
cache := cache.New(daemon.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
|
|
}
|