From f946782316ea5fa635773587bd4c6da7ecf118b8 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Wed, 16 Dec 2015 13:46:40 -0800 Subject: [PATCH] Add support for partial load Missing layers in tar will not cause an error if layers are already loaded before. Fixes #18723 Signed-off-by: Tonis Tiigi --- image/tarexport/load.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/image/tarexport/load.go b/image/tarexport/load.go index 695ddba3ee..688dd88b42 100644 --- a/image/tarexport/load.go +++ b/image/tarexport/load.go @@ -73,9 +73,14 @@ func (l *tarexporter) Load(inTar io.ReadCloser, outStream io.Writer) error { if err != nil { return err } - newLayer, err := l.loadLayer(layerPath, rootFS) + r := rootFS + r.Append(diffID) + newLayer, err := l.ls.Get(r.ChainID()) if err != nil { - return err + newLayer, err = l.loadLayer(layerPath, rootFS) + if err != nil { + return err + } } defer layer.ReleaseAndLog(l.ls, newLayer) if expected, actual := diffID, newLayer.DiffID(); expected != actual {