Przeglądaj źródła

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 rok temu
rodzic
commit
a1f6b64e24
1 zmienionych plików z 6 dodań i 4 usunięć
  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
 		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")
 	return snapshotter.Commit(ctx, id+"-init", id+"-init-key")