The "Docker Run" Fatigue
Think of running a modern web application like cooking a multi-course meal. You need the oven, the stovetop, and the refrigerator all working together at the right time. If you had to manually configure each appliance from scratch every time you cooked, you'd quickly look for a better system. Docker Compose is that better system — a single recipe file that coordinates all the moving parts.
Imagine you are building a standard web application. You need:
1. A Python web server (Django/Flask).
2. A Postgres database.
3. A Redis cache.
To start this locally using standard Docker, you would have to open three terminal tabs and run three separate, long-winded docker run invocations — one to start Postgres with the right password and database name, one to start Redis, and one to start the app with its own port mapping and environment variables pointing at the other two.
This is tedious, error-prone, and hard to share with teammates. The --link flag shown in older tutorials is deprecated. The real approach requires creating a shared network manually, passing environment variables correctly, and ensuring startup order — all before writing a single line of application code.
Enter Docker Compose
Docker Compose is a tool that lets you define your entire multi-container application in a single file, usually named docker-compose.yml. Instead of memorizing long CLI commands, you write the configuration once in YAML. Then, with a single command — docker-compose up — Docker spins up your entire environment, handles the networking, and attaches the storage volumes.
Compose is the industry standard for local development environments and is also used for CI pipelines, integration testing, and simple single-host deployments. It ships bundled with Docker Desktop on macOS and Windows. On Linux, Docker Compose V2 is installed as a plugin (docker compose without the hyphen), while the older standalone V1 binary used docker-compose. Both accept the same YAML format.
Interviewers often ask: "What's the difference between Docker Compose and Kubernetes?" The key distinction is scope and scale. Docker Compose is designed for single-host orchestration — it manages containers on one machine, making it ideal for local development and simple deployments. Kubernetes is designed for multi-host orchestration across a cluster, with built-in self-healing, autoscaling, and rolling deployments. A common follow-up: "Would you use Compose in production?" The honest answer is: for small, low-traffic services on a single server, yes — but for anything requiring high availability or horizontal scaling, Kubernetes or a managed container platform is the right tool.