1. Log in to the Harbor interface with an account that has Harbor system administrator privileges.

  2. Expand Administration, and select Clean Up.

  3. Select the ‘Clean Up’ tab.

  4. To Allow garbage collection on untagged artifacts, select the option. If you have this option turned on, the next time Garbage collect runs on your Harbor instance, Harbor will delete untagged artifacts and then perform garbage collection on them.

  5. To dry run garbage collection, click DRY RUN.

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. Harbor runs garbage collection without interrupting your ability to continue use Harbor, for example you are able to push, pull, or delete artifacts while garbage collection is running.

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.

You are able to schedule garbage colleciton on your Harbor interface from the ‘Garbage Collection’ tab on the Administration > Clean Up page of the Harbor interface.

  1. Use the drop down-menu to select how often to run garbage collection.

    Schedule 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 job.
  2. To Allow garbage collection on untagged artifacts, select the option. If you have this option turned on, the next time Garbage collect runs on your Harbor instance, Harbor will delete untagged artifacts and then perform garbage collection on them.

  3. Click Save.

Each time you run garbage collection on your Harbor instance, Harbor will track some information about the run including:

  • Trigger Type: How the run was initiated, either Manual or by Schedule.
  • Dry Run: If the run was a dry run or not.
  • Status: Current status of the run.
  • Creation Time: Time the run started.
  • Update time: The last time the run was updated.
  • Logs: A link to the logs generated by the run. If you are performing a Dry Run, this will include an estimate of the artifacts that will be garbage collected.

You are able to stop any running garbage collection job from the Garbage Collection History table.

  1. Navigate to Administration > Clean Up page and select the ‘Garbage Collection’ tab.

  2. In the Garbage Collection History table, click on the checkbox next to the Job Id of the running garbage collection. You can stop one or more running garbage collection jobs at one time.