A simple delete operation is not enough to remove images – to be precise, their blob files – from the system. When you use a delete button on the artifacts overview page inside a repository, it simply deletes the corresponding item from the GUI. It means that simple deletion does not clean up your storage, and you may be hitting your project quotas even if you do not see a lot of artifacts in there.
To remove blob files from the system and make some space in your repository, you need to perform an operation known as garbage collection.
To access it:
When you remove a tag from the image, you hide a layer associated with the tag from the Container Registry GUI. The result of the untagging is equal to deletion and, as in the case of deleting an artifact, it does not remove the blob from the system.
Independently of the method you select for garbage collection, make sure to use the slider to specify if you want to include untagged artifacts in the ultimate deletion:
Since some images may take time to upload, there is a mechanism to prevent them from unintentional removal. Any garbage collection operation (including the dry run) only covers images that were not uploaded within the previous two hours.
Garbage collection takes some time and computing capacity. Besides, since some blob files may be shared between artifacts with identical layers, this operation brings some complexity with it. As a result, a running garbage collection may prevent users from working with your repository normally.
For this reason and to avoid losing data that you may still need, we recommend performing a test execution first: a dry run.
2021-09-08T15:50:18Z [INFO] [/jobservice/job/impl/gc/garbage_collection.go:145]: Garbage Collection parameters: [delete_untagged: false, dry_run: true, time_window: 2]
2021-09-08T15:50:18Z [INFO] [/jobservice/job/impl/gc/garbage_collection.go:155]: start to run gc in job.
2021-09-08T15:50:18Z [INFO] [/jobservice/job/impl/gc/garbage_collection.go:411]: artifact trash candidates.
2021-09-08T15:50:18Z [INFO] [/jobservice/job/impl/gc/garbage_collection.go:413]: ID-1 MediaType-application/vnd.docker.container.image.v1+json ManifestMediaType-application/vnd.docker.distribution.manifest.v2+json RepositoryName-library/gc_test Digest-sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792 CreationTime-2021-09-08 15:50:13
2021-09-08T15:50:18Z [INFO] [/jobservice/job/impl/gc/garbage_collection.go:203]: no need to execute GC as there is no non referenced artifacts.
2021-09-08T15:50:18Z [INFO] [/jobservice/job/impl/gc/garbage_collection.go:174]: success to run gc in job.
You can also see how much space will be freed after the execution.
Use the GC Now button to run a real garbage collection. You can access the History tab to monitor the execution and then look into the log file when the job is finished.
To schedule a garbage collection: