What is Docker Compose?
Docker Compose is a tool that lets you describe and run several containers as a single system, using one configuration file, docker-compose.yml.
Why it is needed:
Managing several services
If an application consists of backend + frontend + database + cache, Compose lets you bring everything up with one command:
docker compose upA single configuration
The docker-compose.yml file describes services, networks, volumes, environment variables, ports, and dependencies between containers.
Convenient local development
It is easy to start, stop, rebuild, and update the development environment.
Automatic network creation
Services inside docker-compose see each other by name, without manual configuration.
Example of a minimal config:
services:
app:
build: .
ports:
- "3000:3000"
db:
image: postgres
environment:
POSTGRES_PASSWORD: exampleCompose is needed when a project consists not of a single container, but of a set of services that need to work together.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.