← All projects
102025 / Completed / Personal project

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.

Docker ComposeYAMLFlaskMySQLDocker NetworkingIaC
1 commandFull stack spin-up
2 servicesWeb + database orchestrated
ReproducibleIdentical env across machines

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

  1. 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.

  2. 02

    Used depends_on to express service ordering so the database is created before the application service starts.

  3. 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.

  4. 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.

  5. 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.

Stage 01 — docker-compose.yml declaring the web service (build ., port 5002) and the mysql:8 database service with depends_on.