Docker Compose — Declarative Multi-Service Stack
Replaced a chain of manual docker run, docker network create and port-mapping commands with a single declarative docker-compose.yml that spins up a Flask app and MySQL database as one reproducible stack.
The problem
Running a multi-container app by hand meant creating networks, launching a database with long environment flags and building/running the app container separately every time — slow, error-prone and impossible to reproduce reliably across machines.
What I built
- 01
Authored a declarative docker-compose.yml describing the whole stack: a built web service, its published ports, and a mysql image service with its environment configuration.
- 02
Used depends_on to express service ordering so the database is created before the application service starts.
- 03
Relied on Compose's automatic project bridge network, letting the Flask service reach the database by service name with no manual docker network create.
- 04
Managed the full lifecycle with docker compose up -d, ps, logs -f and down — building, starting, inspecting and tearing down every container, network and resource in single commands.
- 05
Treated the Compose file as infrastructure-as-code and living documentation, so anyone cloning the repo gets an identical environment with one command.
Project stages
01 / 03
Stage 01 — docker-compose.yml declaring the web service (build ., port 5002) and the mysql:8 database service with depends_on.