-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Unsupported MediaType when scanning image from private registry #591
Comments
Thank you for looking into the problem. I raised an issue in google/go-containerregistry. |
Do you happen to know what criteria the registry uses when selecting a media type? I wonder if we can use content negotiation or just ordering of the accept header to indicate which media type we prefer. I would think that, given the choice between two options, registries should always reply with the most recent supported format... but I understand that changing the registry is probably harder than changing a client. We added schema 1 to the accept header originally because it was useful for one of our clients to distinguish between the image not existing vs the image being schema 1. Your argument that we shouldn't include it at all does make sense, though. |
Sorry for the delay. We're using a quite old version of
Proxying requests to registry via
|
This issue is stale because it has been labeled with inactivity. |
Please watch google/go-containerregistry#754. |
Description
I try to scan an image from our private registry and get "Unsupported MediaType" error.
When I inspect HTTP requests, I see that
Accept
header is set toapplication/vnd.docker.distribution.manifest.v1+json,application/vnd.docker.distribution.manifest.v1+prettyjws,application/vnd.docker.distribution.manifest.v2+json,application/vnd.oci.image.manifest.v1+json,application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.oci.image.index.v1+json
.Because of this our registry replies with
Content-Type: application/vnd.docker.distribution.manifest.v1+prettyjws
, which Trivy does not support. I believe it's a bug and unsupported content types should not be listed inAccept
header.If I rewrite HTTP request on the fly (via mitm proxy) and set
Accept
header toapplication/vnd.docker.distribution.manifest.v2+json
, the correct manifest is returned and scan proceeds normally.Output of run with
-debug
:Output of
trivy -v
:The text was updated successfully, but these errors were encountered: