Docker Compose Cheatsheet
Quick reference for running Bachelor Point's local Docker stack (`docker-compose.yml`) with Docker Desktop — building the image, applying Prisma migrations, and managing the `db`, `migrate` and `app` containers.
Stack overview
All commands below assume your terminal's working directory is the project root (wheredocker-compose.yml lives). Docker Compose reads .env in that same folder automatically.
| Service | Image / build target | Purpose | Port |
|---|---|---|---|
db |
postgres:16-alpine |
Postgres database, container name bachelor-point-db |
5432 |
migrate |
Dockerfile (builder target) |
One-shot: prisma migrate deploy → sync-roles → init-admin |
— |
app |
Dockerfile (runner target) |
The production Next.js server | 8080 |
app only starts after migrate completes successfully, so migrations are always applied
before the app comes up.
Bring the stack up (build + migrate + start)
docker compose up -d --build
Builds the image, starts db, waits for it to be healthy, runs migrate to completion, then
starts app. Safe to re-run any time — prisma migrate deploy is idempotent and won't touch
existing data.
Check it worked
docker compose ps
docker compose logs migrate
docker compose logs -f app
Then open http://localhost:8080.
Re-run only the migration (without touching app)
docker compose run --rm migrate
Rebuild only the app after a later code change
docker compose up -d --build app
Open a shell inside the running app container
docker compose exec app sh
Stop everything (keeps your data)
docker compose stop
or to remove the containers too (still keeps the named volumes):
docker compose down
⚠️ Destructive — wipes the database
docker compose down -v
The -v flag deletes the postgres-data named volume — that's the actual Postgres data. Only
run this if you deliberately want a clean slate.
No comments yet.
Sign in to leave a comment.