Skip to main content

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:

javascript
docker compose up

A 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:

yaml
services: app: build: . ports: - "3000:3000" db: image: postgres environment: POSTGRES_PASSWORD: example

Compose 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 ready
Premium

A concise answer to help you respond confidently on this topic during an interview.