cache: fix setting root labels on commit

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2017-12-11 15:35:13 -08:00
parent b7664f71b9
commit 013f95eaf7
1 changed files with 4 additions and 1 deletions

5
cache/refs.go vendored
View File

@ -223,7 +223,10 @@ func (cr *cacheRecord) finalize(ctx context.Context) error {
if mutable == nil {
return nil
}
err := cr.cm.Snapshotter.Commit(ctx, cr.ID(), mutable.ID())
labels := map[string]string{
"containerd.io/gc.root": time.Now().UTC().Format(time.RFC3339Nano),
}
err := cr.cm.Snapshotter.Commit(ctx, cr.ID(), mutable.ID(), cdsnapshot.WithLabels(labels))
if err != nil {
return errors.Wrapf(err, "failed to commit %s", mutable.ID())
}