Skip to content

Commit 5772688

Browse files
authored
Merge pull request #294 from buildpacks/jab/containerd-omit-layers
Always try the fast path first (omitting base layers) regardless of storage type
2 parents d318e60 + 4ca6918 commit 5772688

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

local/store.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,13 @@ func (s *Store) Save(img *Image, withName string, withAdditionalNames ...string)
9494

9595
// save
9696
isContainerdStorage := s.usesContainerdStorageCached()
97-
canOmitBaseLayers := !isContainerdStorage
9897

99-
if canOmitBaseLayers {
100-
// During the first save attempt some layers may be excluded.
101-
// The docker daemon allows this if the given set of layers already exists in the daemon in the given order.
102-
inspect, err = s.doSave(img, withName, isContainerdStorage)
103-
}
104-
if !canOmitBaseLayers || err != nil {
98+
// During the first save attempt some layers may be excluded.
99+
// The docker daemon allows this if the given set of layers already exists in the daemon in the given order.
100+
inspect, err = s.doSave(img, withName, isContainerdStorage)
101+
102+
// If the fast save fails, we need to ensure the layers and try again.
103+
if err != nil {
105104
if err = img.ensureLayers(); err != nil {
106105
return "", err
107106
}

0 commit comments

Comments
 (0)