andrey-pohilko / registry-cli

Scripts for easy manipulation of docker-registry from command line (and from scripts)
GNU General Public License v3.0
891 stars 211 forks source link

Support OCI images #87

Open stelford opened 4 years ago

stelford commented 4 years ago

Howdy.

Currently, if I run registry against a docker registry which has OCI images (generated from podman for example). I get the dreaded "OCI manifest found, but accept header does not support OCI manifests" when using this tool. If any one runs into this, the fix is pretty darned simple. Please change the registry.py as below;

     HEADERS = {"Accept":
-               "application/vnd.docker.distribution.manifest.v2+json"}
+               "application/vnd.docker.distribution.manifest.v2+json,application/vnd.oci.image.manifest.v1+json"}

Regards.

andrey-pohilko commented 4 years ago

Thanks for the suggestion. We will add this into the master branch with some additional command line argument (--oci, I think)

Dne út 28. 1. 2020 21:04 uživatel stelford notifications@github.com napsal:

Howdy.

Currently, if I run registry against a docker registry which has OCI images (generated from podman for example). I get the dreaded "OCI manifest found, but accept header does not support OCI manifests" when using this tool. If any one runs into this, the fix is pretty darned simple. Please change the registry.py as below;

 HEADERS = {"Accept":
  • "application/vnd.docker.distribution.manifest.v2+json"}
  • "application/vnd.docker.distribution.manifest.v2+json,application/vnd.oci.image.manifest.v1+json"}

Regards.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/andrey-pohilko/registry-cli/issues/87?email_source=notifications&email_token=AECNB634AVPCTFD5BKFBKKTRACFTHA5CNFSM4KMYOFMKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IJKSDQQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECNB64XVTEL662F5I53WTLRACFTHANCNFSM4KMYOFMA .

tkarls commented 2 years ago

There is another type. oci index images that gets generated by buildkit cache exports. These images require the

application/vnd.oci.image.index.v1+json

Accpept value. Unfortunatly simply adding this to the Accept header is not sufficient. When trying to delete images older than x hours I get:

Traceback (most recent call last):
  File "/registry.py", line 858, in <module>
    main_loop(args)
  File "/registry.py", line 853, in main_loop
    args.delete_by_hours, keep_tags)
  File "/registry.py", line 641, in delete_tags_by_age
    image_config = registry.get_tag_config(image_name, tag)
  File "/registry.py", line 369, in get_tag_config

I assume that the manifest is a bit different but it would be great if this tool could support them as well! It really helps with the CI cleanup.

ddelange commented 1 year ago

related to https://github.com/docker/buildx/issues/1509: as of v0.10.0, OCI manifests are pushed by default

rwojsznis commented 1 year ago

Accpept value. Unfortunatly simply adding this to the Accept header is not sufficient. When trying to delete images older than x hours I get:

I ran into same issue on a different project; I don't follow build/docker/oci specification so I just searched through github and shoved:

"application/vnd.docker.distribution.manifest.v1+json, application/vnd.docker.distribution.manifest.v1+prettyjws, application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.v2+prettyjws, application/vnd.oci.image.index.v2+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.image.manifest.v2+json, application/vnd.oci.image.manifest.v1+json"

into Accept header (based on other repos); at first glance it seems to "solve" the problem 🤔