Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read image using Docker daemon provider when architecture has variant #143

Open
luhring opened this issue Sep 29, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@luhring
Copy link
Contributor

luhring commented Sep 29, 2022

I was looking at anchore/grype#831, and it seems like this is ultimately a problem with how Stereoscope is determining "architecture" and "variant" values for a given image, particularly in the code path used for reading images using the DaemonImageProvider.

How to reproduce

With Stereoscope checked out locally, run:

go run ./examples/basic.go docker:ghcr.io/mattmoor/static@sha256:b7dcd21f108cfed6c394aa18240a26c02f904337a962ca0ffe17368de5c65a23

And you'll see:

DEBU[0000] image: source=DockerDaemon location=ghcr.io/mattmoor/static@sha256:b7dcd21f108cfed6c394aa18240a26c02f904337a962ca0ffe17368de5c65a23
panic: could not read image: unable to override metadata option: unknown architecture: arm/v7

...

Analysis

On this line, It looks like when the Docker daemon provider is attaching metadata to the image, it's setting the architecture to i.Architecture, and setting the variant to "". During the problem scenario, i.Architecture is set to arm/v7 — which means the variant ("v7") hasn't been separated out correctly. This causes the error to bubble up out of WithArchitecture because arm/v7 isn't in the known architectures list (but arm is).

So my first takeaway is: I think we shouldn't necessarily use "" as the variant in this code path.

But what's also interesting is that the source of the arm/v7 value is this call into the Docker client library. The return type (ImageInspect) has explicit fields for Architecture and Variant separately, so I'm not sure why it's not separating out the v7 into the variant for us so we don't have to.

Curious for your all's thoughts! This issue ends up being a showstopper for Syft and Grype users with Apple Silicon using Docker Desktop and images with variants. 🙏

@luhring luhring added the bug Something isn't working label Sep 29, 2022
@wagoodman wagoodman added this to OSS Jun 27, 2023
@kzantow kzantow moved this to Backlog in OSS Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

1 participant