Home/Glossary/Docker Compose

Docker Compose

A tool for defining and running multi-container Docker applications using YAML configuration files.

Docker Compose is a command-line tool used to orchestrate multi-container Docker applications. It allows developers to define services, networks, and volumes in a single docker-compose.yml file, replacing complex docker run scripts. This declarative approach ensures that the application environment remains consistent across different development and testing machines.

How it works

The tool parses the YAML configuration to create a unified stack. It handles container linking, environment variables, and persistent storage mounts. By executing docker-compose up, the entire infrastructure is provisioned according to the defined specifications, including service dependencies and resource limits.

Key use cases include:

  • Local development: Instant setup of complex stacks like LAMP or PERN with a single command.
  • Automated testing: Spawning ephemeral environments for end-to-end testing in CI pipelines.
  • Prototyping: Rapidly iterating on multi-service architectures without manual networking setup.

Docker Compose V2, integrated directly into the Docker CLI, is written in Go and provides improved performance over the legacy Python version. It supports profiles and multiple override files, enabling environment-specific settings for staging or production-like local testing without duplicating the core configuration.