SkillByAIOpen interactive version →

Lesson 1 / 25

What Docker Compose Is For

Multi-container apps on one machine.

Declarative local environments

Docker Compose defines an application made of several containers (a web front end, an API, a database, a cache, a worker) in one YAML file and manages them together: build images, create networks and volumes, start containers in dependency order, show combined logs, and tear everything down. It is ideal for local development, integration tests in CI, demos and small single-host deployments. For multi-machine production with self-healing and autoscaling, orchestrators such as Kubernetes are the usual next step.

One file, one command, many containers

Compose describes a multi-container application in YAML and runs it with a single command.

Figure 1.1 — Purpose, file and lifecycle.

A recipe card for the whole meal

Instead of remembering how to cook each dish and in what order, the recipe card lists every dish, its ingredients and timing; anyone can reproduce the meal.

Commit the Compose file

A Compose file in the repository lets every new developer start the whole stack with one command.

Quick check: What is Docker Compose best suited for?

  • Replacing a database
  • Training machine learning models
  • Running multi-container apps for development, testing and simple single-host setups
  • Managing thousands of nodes
Answer

Running multi-container apps for development, testing and simple single-host setups — Compose orchestrates containers on one host.