Skip to content

[feature] Handle mounting shared layers cross-images on upload #85

@Dramelac

Description

@Dramelac

Hello,

First of all, thank you very much for this tool!

I'm writing this issue because one of the registry behaviors is not implemented yet. It's not the most common use-case but I wonder if it's planned to be implemented soon or not?

When docker pushes an image, each layer will be uploaded if this is the first time this layer/blob is sent to the registry. But when an image has shared layers that have already been pushed to an A repository and then a new image on another B repository is pushed, docker will try to mount the layer from the A repository to B avoiding re-uploading.

This behavior is described in the Cross Repository Blob Mount section below: https://docker-docs.uclv.cu/registry/spec/api/#pushing-an-image

  • Docker client will send this query to mount a layer from image-A to the new image-B with the common blob ID to mount:
    POST /v2/image-B/blobs/uploads/?from=image-A&mount=sha256%3A6b17377d415bc5e55a5a71a28a74139961b94b9f835c9c29852e7658d76c2ab0
  • The registry should respond with 201 Created if the mount is successful otherwise it will return 202 Accepted to re-upload the layer
  • Currently the serverless-registry (in a wrangler dev environment) reply with 202 and docker will upload again the layer (wich work with docker push command).
  • Some client command (like docker manifest push) doesn't handle when the blob mounting doesn't work and crash with the message error mounting image-a@sha256:6b17377d415bc5e55a5a71a28a74139961b94b9f835c9c29852e7658d76c2ab0 to localhost:8787/image-b:test

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions