caprover / caprover

Scalable PaaS (automated Docker+nginx) - aka Heroku on Steroids
https://CapRover.com
Other
13.02k stars 831 forks source link

Caprover does not clean up registry #2063

Closed pcace closed 4 months ago

pcace commented 4 months ago

Hi there, i have a problem with caprovers ability to work with docker registrys. I currently have this setup:

Server1 with Caprover there is a dockerregistry as a container (app) installed. This registry is set as the registry for Server1 Caprover to push images to (in Registry Settings).

Server2 with Caprover the second server uses the registry on Server1 as default registry to push images to.

now to the Issue: i have discovered, that the images are not disposed correctly it seems like. When deleting containers (apps) from Server1 Caprover or Server2, they will not be removed from the registry. even after cleaning the registry via:

docker exec -it $(docker ps --filter name=srv-captain--dockerregistry -q) bin/registry garbage-collect --delete-untagged /etc/docker/registry/config.yml or purging all dangling containers: docker image prune --all

it also does not help to use the Disk Cleanup function provided by caprover. The non used images in the registry are just not shown, but in the registry there are all tags present since years. (wich adds up a lot in terms of disk space...)

I am by far not an expert when it comes to docker registries, so it might be an issue with the registry itself, but it feels like caprover should handle the deletion of apps also in the registry.

Any idea how i would clean this up or where the problem exactly lies? What can i provide to make it easier to find the problem?

Any help would be great!! Thanks a lot!

githubsaturn commented 4 months ago

docker registry is really a different app. The reason that the images aren't cleaned up is that they are not untagged. The self-hosted registry is same as a 3rd party registry.

The only way to clean up the images in the registry is to deploy a GUI for Docker registry and manually deleting those images. Or just wipe out the entire storage of the images (this doesn't stop the apps that the nodes already have the images pulled).

Method 1: example GUI: https://github.com/Joxit/docker-registry-ui

Method 2: rm -rf /captain/data/registry