Skip to main content

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:
Default: /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.db

Lightweight

No separate database server. Minimal resource usage.

Portable

Move database by copying file. No export/import needed.

Limitations

SQLite has limitations for production workloads:
  • Concurrency: Single writer at a time
  • Network: No remote connections
  • Scale: Not suitable for high-traffic or multi-instance deployments
For production, use PostgreSQL.

Performance Tuning

Dockhand automatically enables these SQLite optimizations:
WAL Mode (Write-Ahead Logging):
  • Allows concurrent reads during writes
  • Better performance than default rollback journal
  • Creates dockhand.db-wal and dockhand.db-shm files

Backup

Backup SQLite database:
Restore backup:

PostgreSQL

Quick Start

Deploy Dockhand with PostgreSQL:
docker-compose-postgresql.yaml
Start:

Connection URL Format

Examples:

SSL/TLS Options

PostgreSQL connection string supports SSL modes:

External PostgreSQL

Connect to an existing PostgreSQL instance:
docker-compose.yaml

Environment File

Store DATABASE_URL in .env file:
.env
docker-compose.yaml
Add .env to .gitignore to prevent committing database credentials.

PostgreSQL Settings

Recommended PostgreSQL configuration:
For Docker:

Backup

Backup PostgreSQL database:
Restore backup:

Maintenance

Routine PostgreSQL maintenance:

Migration Between Databases

SQLite to PostgreSQL

  1. Export data from SQLite:
  2. Convert SQL to PostgreSQL:
  3. Set DATABASE_URL and 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/
Migrations are detected based on DATABASE_URL:

Migration Process

On startup, Dockhand:
  1. Connects to database
  2. Reads migration journal
  3. Compares applied vs pending migrations
  4. Runs pending migrations in order
  5. Seeds initial data (registries, roles, settings)
Logs:

Migration Errors

If migrations fail, Dockhand exits by default:
Skip migrations (debugging only):

Manual Migrations

Run migrations manually:

Schema Health

Check database health via API:
Response:

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: postgres in compose file

Authentication Failed

Error: password authentication failed for user "dockhand" Solution:
  • Check POSTGRES_PASSWORD matches DATABASE_URL password
  • Recreate PostgreSQL container if password changed

Database Does Not Exist

Error: database "dockhand" does not exist Solution:
Or ensure 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

Performance Comparison