When you delete images from Harbor, space is not automatically freed up. You must run garbage collection to free up space by removing blobs that are no longer referenced by a manifest from the file system.
Run Garbage Collection
Log in to the Harbor interface with an account that has Harbor system administrator privileges.
Expand Administration, and select Garbage Collection.
Select the ‘Garbage Collection’ tab.
To delete untagged artifacts, select the check box Delete Untagged Artifacts.
To dry run garbage collection, click DRY RUN.
To run garbage collection immediately, click GC Now.
As of v2.1.0, Harbor runs garbage collection uninterrupted so users can continue pushing, pulling, deleting artifacts.
DRY RUN prints the blobs eligible for deletion, a rough estimation of free up space without removing any data.
To avoid damaging the uploading artifact, the garbage collection introduces a time windows(2 hours) to reserve the recent uploaded layers. Garbage collection does not sweep the manifest & blob files that have a timestamp in the time window.
To avoid triggering the garbage collection process too frequently, the availability of the GC Now button is restricted. Garbage collection can be only run once per minute.
Schedule Garbage Collection
Expand Administration, and select Garbage Collection.
Select the ‘Garbage Collection’ tab.
Use the drop down-menu to select how often to run garbage collection.
- None: No garbage collection is scheduled.
- Hourly: Run garbage collection at the beginning of every hour.
- Daily: Run garbage collection at midnight every day.
- Weekly: Run garbage collection at midnight every Saturday.
- Custom: Run garbage collection according to a
cron
job.
To delete untagged artifacts, select the check box Delete Untagged Artifacts.
Click Save.
Select the History tab to view records of the 10 most recent garbage collection runs.
Click on the Logs link to view the related logs.