Design, build, and query a complete e-commerce analytics database from scratch using PostgreSQL and Docker. This is a separate capstone project with its own richer schema, fresh container, and fresh dataset — not the smaller `devops_sql` schema from Lessons 402-405.
Spin up a fresh PostgreSQL 16 instance in a Docker container with a named volume for data persistence. This capstone intentionally uses a brand-new container and schema so you can build a production-style analytics project from scratch.
docker run -d --name ecommerce-db -e POSTGRES_USER=analytics -e POSTGRES_PASSWORD=analytics123 -e POSTGRES_DB=ecommerce -p 5432:5432 -v ecommerce_pgdata:/var/lib/postgresql/data postgres:16-alpinedocker ps --filter name=ecommerce-db --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'docker exec -it ecommerce-db psql -U analytics -d ecommerce -c 'SELECT version();'We launch PostgreSQL 16 on Alpine Linux (small image) inside Docker. The -e flags set the superuser, password, and default database. Port 5432 is mapped to localhost so external tools can connect. The named volume ecommerce_pgdata ensures data survives container restarts. All subsequent commands use 'docker exec' to run psql inside this container. This capstone is intentionally separate from the `pg-sql-course` container used earlier, because the schema here includes additional analytics-friendly columns like `sku`, `cost`, `stock_qty`, `shipping_cost`, and richer review data.
Container 'ecommerce-db' running and healthy. The SELECT version() query returns something like 'PostgreSQL 16.x on ... compiled by ...'.