From c5c6f36e8326cb33791881bb4a83ff7f051885be Mon Sep 17 00:00:00 2001 From: Yanqiang Miao Date: Wed, 19 Apr 2017 09:43:36 +0800 Subject: [PATCH] Delete the temporary diractory at the end of the function Signed-off-by: Yanqiang Miao --- rootfs/apply.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rootfs/apply.go b/rootfs/apply.go index 8dba3e0f6..d0f2f6dbe 100644 --- a/rootfs/apply.go +++ b/rootfs/apply.go @@ -4,6 +4,7 @@ import ( "context" "io" "io/ioutil" + "os" "github.com/containerd/containerd" "github.com/containerd/containerd/archive" @@ -41,6 +42,7 @@ func ApplyLayer(snapshots snapshot.Snapshotter, mounter Mounter, rd io.Reader, p if err != nil { return "", errors.Wrapf(err, "creating temporary directory failed") } + defer os.RemoveAll(dir) // TODO(stevvooe): Choose this key WAY more carefully. We should be able to // create collisions for concurrent, conflicting unpack processes but we