Skip to content

[24.0 backport] c8d/load: Don't unpack pseudo images#45688

Merged
neersighted merged 5 commits intomoby:24.0from
vvoland:c8d-load-unpack-attestation-24
Jun 2, 2023
Merged

[24.0 backport] c8d/load: Don't unpack pseudo images#45688
neersighted merged 5 commits intomoby:24.0from
vvoland:c8d-load-unpack-attestation-24

Conversation

@vvoland
Copy link
Contributor

@vvoland vvoland commented Jun 2, 2023

- What I did

  • Introduced a better way to iterate over platform-specific manifests from an image.
  • Skip pseudo-images (this includes attestations) when unpacking images in docker load.

- How I did it
Introduced a function which walks over a containerd image and calls the provided handler on a containerd.Image wrapper, that acts against the platform-specific manifest, instead of the parent manifest list.

This is a more convenient way to interact with a multi platform image by containerd.Image interface when acting on a specific platform-manifest.

See individual commits for details.

- How to verify it

$ echo 'FROM alpine' | docker buildx build - --platform linux/amd64,linux/arm64 -t alp -o type=oci,dest=alp.tar
...
$ docker load -i alp.tar
Loaded image: alp

- Description for the changelog
containerd integration: Fix docker load failing when loading an image with attestations

- A picture of a cute animal (not mandatory but encouraged)

vvoland added 5 commits June 2, 2023 15:09
The default implementation of the containerd.Image interface provided by
the containerd operates on the parent index/manifest list of the image
and the platform matcher.

This isn't convenient when a specific manifest is already known and it's
redundant to search the whole index for a manifest that matches the
given platform matcher. It can also result in a different manifest
picked up than expected when multiple manifests with the same platform
are present.

This introduces a walkImageManifests which walks the provided image and
calls a handler with a ImageManifest, which is a simple wrapper that
implements containerd.Image interfaces and performs all containerd.Image
operations against a platform specific manifest instead of the root
manifest list/index.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit fabc1d5)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 5210f48)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit b08bff8)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Don't unpack image manifests which are not a real images that can't be
unpacked.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 4d3238d)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 4295806)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland added impact/changelog area/images Image Distribution kind/bugfix PR's that fix bugs containerd-integration Issues and PRs related to containerd integration labels Jun 2, 2023
@vvoland vvoland added this to the 24.0.3 milestone Jun 2, 2023
@vvoland vvoland changed the title c8d/load: Don't unpack pseudo images [backport 24.0] c8d/load: Don't unpack pseudo images Jun 2, 2023
@thaJeztah thaJeztah changed the title [backport 24.0] c8d/load: Don't unpack pseudo images [24.0 backport] c8d/load: Don't unpack pseudo images Jun 2, 2023
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@neersighted
Copy link
Member

Failure is unrelated:

=== Failed
=== FAIL: github.com/docker/docker/integration/container TestRenameAnonymousContainer (12.84s)
    rename_test.go:167: assertion failed: 0 (int) != 1 (inspect.State.ExitCode int): container f3024fab08c3ee899bef46d6a6b40d3247f7c9d8e87cacf10b18e427e98307fa exited with the wrong exitcode: 

@neersighted neersighted merged commit c671434 into moby:24.0 Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/images Image Distribution containerd-integration Issues and PRs related to containerd integration impact/changelog kind/bugfix PR's that fix bugs status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants