init — Set up in 30 seconds
Run once. It walks you through everything interactively.
- Config (safe stuff) goes to
dbdock.config.json— commit this - Secrets go to
.env— never committed,.gitignoreupdated automatically
DBDOCK_DB_URL (or DATABASE_URL) and other env vars and DBDock will use env-only configuration.
migrate-config — Fix legacy configs
dbdock.config.json from an older version? This extracts them to .env, cleans up your config, and updates .gitignore. One command, done.
backup — One command, full backup
Real-time progress. Streams directly to your storage provider. Done.
Options
| Option | Description |
|---|---|
--encrypt / --no-encrypt | Toggle encryption (overrides config) |
--compress / --no-compress | Toggle compression (overrides config) |
--encryption-key <key> | Specify a 64-char hex encryption key |
--compression-level <1-11> | Set compression level (default: 6) |
Example
Backup Formats
DBDock supports multiple PostgreSQL backup formats:custom(default) - PostgreSQL custom binary format (.sql)plain- Plain SQL text format (.sql)directory- Directory format (.dir)tar- Tar archive format (.tar)
Generate Encryption Key
Generate a secure 64-character hexadecimal encryption key:restore — Interactive restore with smart filtering
- Show recent (last 10)
- Date range (24h, 7d, 30d, 90d, custom)
- Search by keyword/ID
- Run
npx dbdock restore - Select a backup
- Choose “New Database Instance (Migrate)”
- Enter connection details for the target database
list — See all your backups
Options
| Option | Description |
|---|---|
--recent <number> | Show the last N backups |
--search <keyword> | Search backups by keyword or ID |
--days <number> | Show backups from the last N days |
Examples
copydb — Copy a database with just two URLs
No config files. No setup. Just paste two PostgreSQL URLs.
pg_dump directly into pg_restore — no temp files, no waiting.
Options
| Option | Description |
|---|---|
--schema-only | Copy tables, indexes, constraints — no data |
--data-only | Copy data only (schema must exist on target) |
--verbose | Show detailed pg_dump/pg_restore output |
Environment consolidation
delete — Remove backups
cleanup — Auto-clean old backups
schedule — Manage cron schedules
dbdock.config.json.
Heads up: Schedules only run when DBDock is integrated into your Node.js app (see Programmatic Usage). The CLI just manages the config.
analyze — Understand your database first
migrate — Cross-database migration (MongoDB ↔ PostgreSQL)
--dry-run, --incremental --since <date>, --config, --export-config, --batch-size, --max-depth. Failed rows go to _migration_errors; nothing executes without your confirmation.
