go-containerregistry icon indicating copy to clipboard operation
go-containerregistry copied to clipboard

crane: allow appending of complete docker images

Open tnaroska opened this issue 4 years ago • 4 comments

Describe the bug

I have a use case were I would like to append all layers of image A onto image B to create a new image C. First idea was to use crane rebase with old_base set to an empty (scratch) image. However, this results in crane trying to load scratch from the registry and an image not found error.

To Reproduce

crane rebase -t C --new_base B  --old_base scratch A
Error: rebasing image: GET https://index.docker.io/v2/library/scratch/manifests/latest: MANIFEST_UNKNOWN: manifest unknown; unknown tag=latest

Expected behavior

Rebase must not try to resolve scratch from a remote registry, but rather treat it as an empty image. A rebase operation with a --old_base=scratch then practically becomes an append operation. Since scratch has no content, no layers of the original image are removed and all of originals image then appended to the new base.

Additional context

  • Output of crane version
$ crane version
0.8.0

tnaroska avatar Feb 18 '22 05:02 tnaroska