pg-docker-setup
v1.0.4
Published
Interactive CLI to spin up PostgreSQL Docker containers — works on Windows, macOS and Linux
Maintainers
Readme
🐘 pg-docker-setup
Interactive CLI to spin up PostgreSQL Docker containers in seconds.
Works on Windows, macOS, and Linux — no bash required.
Requirements
- Node.js >= 18
- Docker Desktop (running)
Usage
No install needed — just run:
npx pg-docker-setupOr install it globally once:
npm install -g pg-docker-setup
pg-dockerWhat it does
The CLI walks you through every field one by one:
╔══════════════════════════════════════════════╗
║ 🐘 PostgreSQL Docker Setup ║
╚══════════════════════════════════════════════╝
Platform : macOS
Node : v20.11.0
✔ Docker is running
── Container settings ────────────────────────
Container name [postgresDB]: myapp-db
PostgreSQL version [16]:
Database name [mydb]: myapp
Database user [admin]:
Password: ********
Host port [5432]:
── Review ────────────────────────────────────
Container : myapp-db
Image : postgres:16
Database : myapp
User : admin
Password : ********
Port : 5432 → 5432
Conn str : postgresql://admin:***@localhost:5432/myapp
Proceed? [Y/n]:After confirming, it pulls the image, starts the container, waits until PostgreSQL is ready, then prints everything you need:
✔ PostgreSQL is ready!
Connection string:
postgresql://admin:password@localhost:5432/myapp
Prisma .env:
DATABASE_URL="postgresql://admin:password@localhost:5432/myapp"
Useful commands:
Stop : docker stop myapp-db
Start : docker start myapp-db
Remove : docker rm -f myapp-db
Shell : docker exec -it myapp-db psql -U admin -d myapp
Logs : docker logs myapp-dbOptions / defaults
All fields have sensible defaults — just hit Enter to accept them.
| Field | Default |
|---|---|
| Container name | postgresDB |
| PostgreSQL version | 16 |
| Database name | mydb |
| Database user | admin |
| Password | password |
| Host port | 5432 |
Platform notes
Windows — runs natively in PowerShell or cmd. No Git Bash or WSL needed. Password input is visible (no raw mode on Windows cmd), which is fine for a local dev tool.
macOS / Linux — password input is hidden as you type. Colors render in any modern terminal.
CI / non-TTY — colors are automatically disabled when output is piped or redirected.
Prisma setup
After running pg-docker, copy the printed DATABASE_URL into your .env:
DATABASE_URL="postgresql://admin:password@localhost:5432/myapp"Then run your migrations:
npx prisma migrate devIf you use the Neovim plugin
There's a companion Neovim plugin — pg-docker.nvim — that gives you the same workflow inside Neovim with :PgCreate, :PgQuickStart, floating output windows, and clipboard copy of DATABASE_URL.
License
MIT
