Browse code

builder: support for images without layers

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Tonis Tiigi authored on 2018/05/23 13:48:20
Showing 1 changed files
... ...
@@ -293,6 +293,9 @@ func (p *puller) Snapshot(ctx context.Context) (cache.ImmutableRef, error) {
293 293
 	if p.config != nil {
294 294
 		img, err := p.is.ImageStore.Get(image.ID(digest.FromBytes(p.config)))
295 295
 		if err == nil {
296
+			if len(img.RootFS.DiffIDs) == 0 {
297
+				return nil, nil
298
+			}
296 299
 			ref, err := p.is.CacheAccessor.GetFromSnapshotter(ctx, string(img.RootFS.ChainID()), cache.WithDescription(fmt.Sprintf("from local %s", p.ref)))
297 300
 			if err != nil {
298 301
 				return nil, err
... ...
@@ -431,6 +434,10 @@ func (p *puller) Snapshot(ctx context.Context) (cache.ImmutableRef, error) {
431 431
 		}
432 432
 	}()
433 433
 
434
+	if len(mfst.Layers) == 0 {
435
+		return nil, nil
436
+	}
437
+
434 438
 	layers := make([]xfer.DownloadDescriptor, 0, len(mfst.Layers))
435 439
 
436 440
 	for i, desc := range mfst.Layers {