mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
builder: support for images without layers
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
72d10ced7d
commit
9328f0479b
1 changed files with 7 additions and 0 deletions
|
@ -293,6 +293,9 @@ func (p *puller) Snapshot(ctx context.Context) (cache.ImmutableRef, error) {
|
|||
if p.config != nil {
|
||||
img, err := p.is.ImageStore.Get(image.ID(digest.FromBytes(p.config)))
|
||||
if err == nil {
|
||||
if len(img.RootFS.DiffIDs) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
ref, err := p.is.CacheAccessor.GetFromSnapshotter(ctx, string(img.RootFS.ChainID()), cache.WithDescription(fmt.Sprintf("from local %s", p.ref)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -431,6 +434,10 @@ func (p *puller) Snapshot(ctx context.Context) (cache.ImmutableRef, error) {
|
|||
}
|
||||
}()
|
||||
|
||||
if len(mfst.Layers) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
layers := make([]xfer.DownloadDescriptor, 0, len(mfst.Layers))
|
||||
|
||||
for i, desc := range mfst.Layers {
|
||||
|
|
Loading…
Add table
Reference in a new issue