What is Docker Compose mainly used for?
Options
- Orchestrating production clusters across many separate hosts
- Running multi-container apps from one YAML file, mostly in dev (Correct option)
- Building images faster by sharing a remote cache between many hosts
- Replacing Kubernetes in every production environment of a company
Answer
Defining and running multi-container setups (app, DB, cache) from one YAML file, typically for local dev and CI
Why
A real app often needs several containers: your API, PostgreSQL, Redis, a worker. Starting each by hand is tedious.
With Compose you describe all of them, plus their ports, volumes and environment variables, in docker-compose.yml, and start everything with docker compose up.
For production across many machines, Kubernetes or a managed container service is more common.
Remember
Compose = many containers, one file, one command.