c8d/builder: Don't use diffID as snapshot parent
DiffID is only a digest of the one tar layer and matches the snapshot ID only for the first layer (DiffID = ChainID). Instead of generating random ID as a key for rolayer, just use the snapshot ID of the unpacked image content and use it later as a parent for creating a new RWLayer. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
parent
8c7e19c5ff
commit
c6bded3475
1 changed files with 3 additions and 4 deletions
|
@ -194,11 +194,10 @@ func newROLayerForImage(ctx context.Context, imgDesc *ocispec.Descriptor, i *Ima
|
|||
return nil, err
|
||||
}
|
||||
|
||||
key := stringid.GenerateRandomID()
|
||||
parent := identity.ChainID(diffIDs).String()
|
||||
imageSnapshotID := identity.ChainID(diffIDs).String()
|
||||
|
||||
return &rolayer{
|
||||
key: key,
|
||||
key: imageSnapshotID,
|
||||
c: i.client,
|
||||
snapshotter: i.snapshotter,
|
||||
diffID: "", // Image RO layer doesn't have a diff.
|
||||
|
@ -242,7 +241,7 @@ func (rl *rolayer) NewRWLayer() (builder.RWLayer, error) {
|
|||
}
|
||||
|
||||
key := stringid.GenerateRandomID()
|
||||
mounts, err := snapshotter.Prepare(ctx, key, rl.diffID.String())
|
||||
mounts, err := snapshotter.Prepare(ctx, key, rl.key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue