diff --git a/image.go b/image.go index 154bc503f9d..7c55020abea 100644 --- a/image.go +++ b/image.go @@ -321,10 +321,7 @@ func (i *containerImageRef) NewImageSource(ctx context.Context, sc *types.System } // If we're not re-exporting the data, and we're reusing layers individually, reuse // the blobsum and diff IDs. - if !i.exporting && !i.squash && layerID != i.layerID { - if layer.UncompressedDigest == "" { - return nil, errors.Errorf("unable to look up size of layer %q", layerID) - } + if !i.exporting && !i.squash && layerID != i.layerID && layer.UncompressedDigest != "" { layerBlobSum := layer.UncompressedDigest layerBlobSize := layer.UncompressedSize diffID := layer.UncompressedDigest diff --git a/tests/namespaces.bats b/tests/namespaces.bats index d0c0aec2381..84b525cbc74 100644 --- a/tests/namespaces.bats +++ b/tests/namespaces.bats @@ -203,6 +203,9 @@ load helpers expect_output "$rootuid:$rootgid 4700" run_buildah run $RUNOPTS "$ctr" stat -c '%u:%g %a' /somedir/someotherfile expect_output "0:0 4700" + + # Check that a container with mapped-layer can be committed. + run_buildah commit "$ctr" localhost/alpine-working:$i done }