singularityhub / sregistry

server for storage and management of singularity images
https://singularityhub.github.io/sregistry
Mozilla Public License 2.0
103 stars 42 forks source link

Overwritten containers still exist in the minio backend #318

Closed RonaldEnsing closed 4 years ago

RonaldEnsing commented 4 years ago

If I push a new container to sregistry with the same name and tag I expect it to overwrite (replace) the existing container. That is also what the sregistry web interface shows: Only a single container. However, the overwritten container is not removed on the minio backend and also still takes up space on the file system. Is this intended behaviour?

vsoch commented 4 years ago

I would have assumed that Minio would handle this but it seems to not be the case. If you’d like to look into what others with Minio do and make a suggested change to the code we can address this. Please ping me in perhaps early August I have too many things on my plate now.

vsoch commented 4 years ago

Would it just be one call to remove_object? https://docs.min.io/docs/python-client-api-reference.html#remove_object

vsoch commented 4 years ago

@RonaldEnsing this might be easier than I think - could you provide an example set of commands (with a small container, possibly busybox) that I can use to reproduce your issue, and show me what the minio storage interface and it's storage folder on the filesystem look like before and after? I think we would need to do a couple of things. First, add a setting that gives the user control to clean up previous images. Second, in the Minio completed view (which now mostly just returns the success status) we would want to check for that variable and then query for the container name, hopefully find two, and only keep the latest pushed. What do you think?

vsoch commented 4 years ago

okay I've reproduced your issue! To be clear, this happens when you push a different version of a container to the same name / tag (e.g., in this example I tried pushing the same busybox container, and it resulted with just one image. However when I pulled an ubuntu image and pushed it as busybox, I now have two containers):

image

but of course Singularity Registry only knows about the last one (and essentially the original is not cleaned up).

image

I can see a user wanting to keep old images in some very niche use cases, but I think you're right that for the most part, cleanup would be wanted. I will have a PR for your shortly! Thank you for your patience on this, I had a big talk yesterday and my plate is cleaning up now :)

vsoch commented 4 years ago

@RonaldEnsing please see https://github.com/singularityhub/sregistry/pull/319.