Skip to main content
The harbor cache command group provides utilities for managing Harbor’s cache, including downloaded datasets, Docker images, and temporary files.

Commands

harbor cache clean

Clean Harbor cache by removing Docker images and the cache directory.

Options

boolean
Skip confirmation prompt and clean immediately. Default: false
boolean
Show what would be cleaned without actually cleaning. Default: false
boolean
Skip Docker image cleanup. Default: false
boolean
Skip cache directory cleanup. Default: false

Examples

Clean cache with confirmation:
Clean without confirmation:
Dry run to see what would be cleaned:
Clean only Docker images:
Clean only cache directory:

What Gets Cleaned

Cache Directory

Location: ~/.cache/harbor/ Contains:
  • tasks/: Downloaded datasets and tasks
  • jobs/: Job results (only if inside cache)
  • registry/: Cached registry metadata
  • environments/: Environment build caches
Example structure:

Docker Images

The command removes Docker images matching these patterns:
  • alexgshaw/* - Harbor base images
  • hb__* - Harbor environment images (prefix: “harbor build”)
  • sb__* - Sandbox environment images (prefix: “sandbox build”)
Example images:

Usage Examples

Basic Cleanup

Clean everything with confirmation:
Output:

Check Before Cleaning

Use dry run to see what would be removed:
Output:

Automated Cleanup

Clean without prompts (useful for scripts):

Selective Cleanup

Clean only Docker images (preserve downloaded tasks):
Clean only cache directory (preserve Docker images):

When to Clean Cache

Free Up Disk Space

Docker images and cached tasks can consume significant storage:

After Evaluations

Clean up after completing evaluations:

Before Major Updates

Clean cache before updating Harbor:

Development Workflow

Clean frequently during development:

Advanced Usage

Preserve Specific Jobs

Move important job results before cleaning:

Scheduled Cleanup

Automate cache cleanup with cron:

Selective Docker Cleanup

Clean only old Docker images:

Monitor Cache Size

Check cache size before and after:

Troubleshooting

Docker Cleanup Fails

If Docker cleanup fails:

Permission Issues

If cache directory cleanup fails:

Partial Cleanup

If cleanup is interrupted:

Best Practices

Regular Cleanup

Clean cache periodically:

Before Long-Running Jobs

Clean cache to ensure enough disk space:

Development Iterations

Clean frequently during development:

CI/CD Integration

Clean cache in CI/CD pipelines:

See Also