Docker¶
The Tech Strategy Tool uses Docker Compose to run PostgreSQL for development. The .NET application runs directly on the host — there is no Dockerfile or app container. This page covers the Docker setup, database management, and common operations.
Docker Compose Configuration¶
The development infrastructure is defined in docker/docker-compose.yml. It contains a single service:
This starts a PostgreSQL 17 container with:
| Setting | Value |
|---|---|
| Image | postgres:17 |
| Port | 5432:5432 (host:container) |
| Database | techstrat |
| Username | techstrat |
| Password | techstrat_dev |
| Volume | techstrat-pgdata mounted at /var/lib/postgresql/data |
| Healthcheck | pg_isready -U techstrat -d techstrat every 10s (timeout 5s, 5 retries) |
No other services are defined — no Redis, no message broker, no app container.
Starting the Database¶
The -d flag runs the container in detached mode (background). The database is ready when the healthcheck passes.
To check the status:
Stopping the Database¶
Stop (preserve data)¶
This stops and removes the container but preserves the techstrat-pgdata volume. Restarting with up -d will resume with existing data.
Stop and reset data¶
docker compose -f docker/docker-compose.yml down -v
docker compose -f docker/docker-compose.yml up -d
The -v flag removes volumes, destroying all data. The next application startup will auto-apply EF Core migrations to create the schema.
Data loss
Using down -v permanently deletes all events, checkpoints, users, and sessions. This is useful for development resets but should never be done in a production environment.
Database Schema¶
EF Core migrations are the sole source of truth for the database schema. In Development mode, migrations are auto-applied on application startup via db.Database.MigrateAsync(). A fresh Docker container starts with an empty database — the application creates all tables and indexes automatically on first run.
See Migrations for schema management details.
Connecting to the Database¶
To connect to the development database directly:
Or using any PostgreSQL client with the connection details in the table above.
Viewing Logs¶
Integration Tests¶
Integration tests (TechStrat.Api.Tests and TechStrat.Infrastructure.Tests) use Testcontainers to spin up isolated PostgreSQL instances automatically. They do not use the development Docker Compose database.
This means:
- You can run integration tests while the dev database is running
- Tests are isolated and do not affect dev data
- Docker must be running for integration tests to work
Troubleshooting¶
Port 5432 already in use¶
If another PostgreSQL instance is running on port 5432:
Either stop the conflicting service or modify the port mapping in docker-compose.yml.
Container fails to start¶
Check the logs for errors:
Common issues:
- Port conflict — another service on port 5432
- Disk space — Docker ran out of disk space
- Corrupted volume — reset with
down -vandup -d