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

Cannot delete image from Artifactory #1009

Closed
nc-nvmt opened this issue Nov 18, 2019 · 16 comments
Closed

Cannot delete image from Artifactory #1009

nc-nvmt opened this issue Nov 18, 2019 · 16 comments
Labels
kind/feature A request for, or a PR adding, new functionality

Comments

@nc-nvmt
Copy link

nc-nvmt commented Nov 18, 2019

This issue have been already mentioned once here

I am able to inspect/copy the image on Artifactory but I got 406 Not acceptable why I tried to delete the image

The issue above state that is to enable delete config for Docker Registry. However I could not found any document relate to modify config.yml of Artifactory Docker Registry

I obtain the folllowing error

DEBU[0000] Using registries.d directory /etc/containers/registries.d for sigstore configuration
DEBU[0000]  Using "default-docker" configuration
DEBU[0000]   Using file:///var/lib/atomic/sigstore
DEBU[0000] Looking for TLS certificates and private keys in /etc/docker/certs.d/<REGISTRY>
DEBU[0000] GET https://<REGISTRY>/v2/
DEBU[0000] Ping https://<REGISTRY>/v2/ err <nil>
DEBU[0000] Ping https://<REGISTRY>/v2/ status 401
DEBU[0001] GET https://<REGISTRY>/v2/<IMAGE>/manifests/<VERSION>
DEBU[0002] DELETE https://<REGISTRY>/v2/<IMAGE>/manifests/sha256:<SHA>
FATA[0003] Failed to delete /v2/<IMAGE>/manifests/sha256:<SHA>: {
  "errors" : [ {
    "status" : 406,
    "message" : "Not Acceptable"
  } ]
} (406 Not Acceptable)

It would be nice to support Artifactory too. We distribute our images to both Artifactory and Openshift Regsitry so right now we need 2 different tool (jfrog cli and skopeo) to cleanup images

@mtrmac
Copy link
Collaborator

mtrmac commented Nov 18, 2019

It would be great to add documentation to skopeo delete showing how to configure Artifactory to allow this; I’m afraid I have no idea what the documentation should say (if it is possible at all).

https://github.com/jfrog/jfrog-cli/blob/master/artifactory/commands/generic/delete.go looks quite different from the docker/distribution API, so that is probably no help for figuring out if the client is doing something wrong.

@nc-nvmt
Copy link
Author

nc-nvmt commented Nov 19, 2019

@mtrmac yes. the jfrog cli is using the different API from Docker. It is using the same API for deleting artifacts and it is not compatiable with standard Docker API. I hope that someone could find a solution or an implementation for it.

@rhatdan
Copy link
Member

rhatdan commented Nov 19, 2019

Can someone reach out to Jfrog to see if they would be interested in adding support for skopeo or at least explaining what should be done.

@dohnto
Copy link

dohnto commented Nov 20, 2019

We are also affected by this.

@gauravpriyolkar
Copy link

+1

Here's what the Artifactory documentation has to say on deletion - https://www.jfrog.com/confluence/display/RTF/Docker+Registry#DockerRegistry-DeletionandCleanup

The <Docker v2 repository name> should be available in the responses from Artifactory API (perhaps redacted in @nc-nvmt debug output) as follows -

DEBU[0000] GET https://<REGISTRY>/artifactory/api/docker/<Docker v2 repository name>/v2/token?account=...scope=...&service=...

For Artifactory, skopeo would then have to delete as follows -

DELETE https://<REGISTRY>/artifactory/<Docker v2 repository name>/<IMAGE>

@rhatdan
Copy link
Member

rhatdan commented Dec 4, 2019

@mtrmac @vrothberg WDYT? Artifactory has a large enough installed base, that this might make sense to special case it?

@vrothberg
Copy link
Member

Assuming we can cleanly distinguish artifactory from docker/distribution, sure. It would be great to cover that!

@rhatdan
Copy link
Member

rhatdan commented Dec 4, 2019

If initial attempt at removing fails can we just try this method? If second try fails return first error.

@btashton
Copy link

btashton commented Dec 4, 2019

@vrothberg There is a header returned on all api calls that identifies the artifactory server id X-Artifactory-Id. This could even be determined while making calls to things like the docker token endpoint which would then skip the first failure case.

@vrothberg
Copy link
Member

@btashton, brilliant, thanks! We are quite busty over here, so I cannot give any ETA but we're always welcoming contributions. If someone is willing to contribute, we'd be happy to guide them through the code.

@mtrmac
Copy link
Collaborator

mtrmac commented Dec 5, 2019

If initial attempt at removing fails can we just try this method? If second try fails return first error.

(Let’s use the positive X-Artifactory-Id identification, instead of sending DELETE requests to URL namespaces undefined by docker/distribution, which have unknown effects in principle.)

@irispenker

This comment has been minimized.

@mtrmac mtrmac transferred this issue from containers/skopeo Aug 8, 2020
@mtrmac mtrmac added the kind/feature A request for, or a PR adding, new functionality label Dec 8, 2022
@Pvlerick
Copy link
Contributor

Hello, I'm taking a look at this; I'll keep you posted :-)

@Pvlerick
Copy link
Contributor

Well, this is now supported by Artifactory (at least in 7.46.11 where I just tested it).

I'm not sure if it's worth it to make a fix for older version, it's hard to find out when exactly this was fixed, if documented at all...

@mtrmac
Copy link
Collaborator

mtrmac commented Jun 20, 2023

Thanks for checking.

Considering how long this has been open on our side, and that testing the newly-developed code would require deploying some older (increasingly obsolete) version, I’m inclined to close this issue and just recommend upgrading.

@rhatdan
Copy link
Member

rhatdan commented Jun 20, 2023

SGTM

@rhatdan rhatdan closed this as completed Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for, or a PR adding, new functionality
Projects
None yet
Development

No branches or pull requests

9 participants