浏览代码

Don't call setupInit in a temp mount if setupInit is nil

This is consistent with layerStore's CreateRWLayer behaviour.

Potentially this can be refactored to avoid creating the -init layer,
but as noted in layerStore's initMount, this name may be special, and
should be cleared-out all-at-once.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Paul "TBBle" Hampson 1 年之前
父节点
当前提交
a1f6b64e24
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. 6 4
      daemon/containerd/image_snapshot.go

+ 6 - 4
daemon/containerd/image_snapshot.go

@@ -87,10 +87,12 @@ func (i *ImageService) prepareInitLayer(ctx context.Context, id string, parent s
 		return err
 	}
 
-	if err := mount.WithTempMount(ctx, mounts, func(root string) error {
-		return setupInit(root)
-	}); err != nil {
-		return err
+	if setupInit != nil {
+		if err := mount.WithTempMount(ctx, mounts, func(root string) error {
+			return setupInit(root)
+		}); err != nil {
+			return err
+		}
 	}
 
 	return snapshotter.Commit(ctx, id+"-init", id+"-init-key")