Skip to main content
cleanup applies the retention policy from dbdock.config.json. It’s automatic (when runAfterBackup: true) and manual (via this command).

Options

Interactive preview (default)

Dry run

See what would happen without doing it:
Exits with code 0 if there’s nothing to delete, so it’s safe in CI.

Force (no prompt)

For automated cleanup in cron jobs:
Combined with cron:

Retention policy

Defined in dbdock.config.json:

How the rules combine

  1. Start with all backups
  2. Sort by age, newest first
  3. The most recent minBackups are untouchable
  4. Of the rest, delete anything exceeding maxBackups or older than maxAgeDays
minBackups always wins. If you have 3 backups and minBackups: 5, cleanup deletes nothing.

Strategies

See Retention strategies for common policies (daily/weekly/monthly rotations, archival rules, etc.).