From df8ece5a4143e4ebc44ce666425df59b6b8935c6 Mon Sep 17 00:00:00 2001 From: Yanqiang Miao Date: Thu, 20 Apr 2017 12:59:33 +0800 Subject: [PATCH] Avoid creating snapshots repeatedly Signed-off-by: Yanqiang Miao --- rootfs/apply.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rootfs/apply.go b/rootfs/apply.go index 8dba3e0f6..da20775ab 100644 --- a/rootfs/apply.go +++ b/rootfs/apply.go @@ -69,7 +69,7 @@ func ApplyLayer(snapshots snapshot.Snapshotter, mounter Mounter, rd io.Reader, p digester := digest.Canonical.Digester() // used to calculate diffID. rd = io.TeeReader(rd, digester.Hash()) - if _, err := archive.Apply(context.Background(), key, rd); err != nil { + if _, err := archive.Apply(context.Background(), dir, rd); err != nil { return "", err } @@ -80,7 +80,7 @@ func ApplyLayer(snapshots snapshot.Snapshotter, mounter Mounter, rd io.Reader, p chainID = identity.ChainID([]digest.Digest{parent, chainID}) } if _, err := snapshots.Stat(ctx, chainID.String()); err == nil { - return diffID, nil //TODO: call snapshots.Remove(ctx, key) once implemented + return diffID, snapshots.Remove(ctx, key) } return diffID, snapshots.Commit(ctx, chainID.String(), key)