Multi-container apps as one YAML file
compose.yaml (or docker-compose.yaml, both valid) describes a stack — multiple containers, their networks, their volumes, their dependencies. docker compose up brings the whole stack online. Same YAML grammar as Kubernetes; very different semantics (single host, no reconciliation).
The three top-level sections you'll touch
services— the containers. Each named, withimageorbuild,ports,environment,volumes,depends_on.volumes— named persistent disks (Postgres data, ML model cache).networks— usually one default; declare extras for cross-stack wiring.
The depends_on nuance
By default, depends_on means 'start in this order' — not 'wait until ready.' For real readiness, use condition: service_healthy and define a healthcheck on the depended-on service. The plain form is a foot-gun: your app starts before Postgres accepts connections.
The version: "3.8" line is dead. Compose Spec v2 (2020+) ignores the
version: field. New files should omit it. Old files with version: "3.8" still work but the field is decorative. Don't copy it from old tutorials thinking it does something.