Overview
Dockhand supports two database backends:- SQLite (default) - Zero-configuration, single-file database
- PostgreSQL - Production-grade, scalable relational database
SQLite (Default)
Configuration
By default, Dockhand uses SQLite with no configuration required. The database is automatically created at:/app/data/db/dockhand.db (Docker) or ./data/db/dockhand.db (local)
Docker Deployment
docker-compose.yaml
Advantages
Zero Configuration
No setup required. Database created automatically on first run.
Simple Backups
Backup by copying a single file:
dockhand.dbLightweight
No separate database server. Minimal resource usage.
Portable
Move database by copying file. No export/import needed.
Limitations
For production, use PostgreSQL.Performance Tuning
Dockhand automatically enables these SQLite optimizations:- Allows concurrent reads during writes
- Better performance than default rollback journal
- Creates
dockhand.db-walanddockhand.db-shmfiles
Backup
Backup SQLite database:PostgreSQL
Quick Start
Deploy Dockhand with PostgreSQL:docker-compose-postgresql.yaml
Connection URL Format
SSL/TLS Options
PostgreSQL connection string supports SSL modes:External PostgreSQL
Connect to an existing PostgreSQL instance:docker-compose.yaml
Environment File
StoreDATABASE_URL in .env file:
.env
docker-compose.yaml
PostgreSQL Settings
Recommended PostgreSQL configuration:Backup
Backup PostgreSQL database:Maintenance
Routine PostgreSQL maintenance:Migration Between Databases
SQLite to PostgreSQL
-
Export data from SQLite:
-
Convert SQL to PostgreSQL:
-
Set
DATABASE_URLand restart:
Recommendation: Start fresh with PostgreSQL instead of migrating. Use Dockhand’s Git integration or Compose file exports to preserve stack configurations.
PostgreSQL to SQLite
Downgrading from PostgreSQL to SQLite is not recommended. SQLite lacks features required for production workloads.Migrations
Dockhand automatically runs database migrations on startup.Migration Folders
- SQLite:
./drizzle/ - PostgreSQL:
./drizzle-pg/
DATABASE_URL:
Migration Process
On startup, Dockhand:- Connects to database
- Reads migration journal
- Compares applied vs pending migrations
- Runs pending migrations in order
- Seeds initial data (registries, roles, settings)
Migration Errors
If migrations fail, Dockhand exits by default:Manual Migrations
Run migrations manually:Schema Health
Check database health via API:Troubleshooting
Connection Refused
Error:Error: connect ECONNREFUSED
Solution:
- Check PostgreSQL is running:
docker compose ps postgres - Verify connection URL host matches service name
- Ensure
depends_on: postgresin compose file
Authentication Failed
Error:password authentication failed for user "dockhand"
Solution:
- Check
POSTGRES_PASSWORDmatchesDATABASE_URLpassword - Recreate PostgreSQL container if password changed
Database Does Not Exist
Error:database "dockhand" does not exist
Solution:
POSTGRES_DB=dockhand in postgres service.
Migration Failed
Error:MIGRATION FAILED: table already exists
Solution:
SQLite Locked
Error:database is locked
Solution:
- Stop all Dockhand instances accessing the database
- Ensure only one Dockhand container uses the SQLite file
- Migrate to PostgreSQL for multi-instance deployments
