- 1. Background
- 2. Quick Start
Docker Compose is a tool provided by Docker that helps run and orchestrate multiple containers on a single Docker host. It provides the ability to build, run, and scale applications consisting of multiple services, each running in seperate containers.
Most modern applications consist of sevral services that work together. When using Docker containers, each application service runs in its own container.[1:1]
docker container run command can be too complicated to run such a multi-service application.[1:2]
The Docker Compose tool provides a more efficient way, using YAML files to define the application for the Docker engine in a declarative way.[1:3]
Docker Compose expects a YAML file called,
docker-compose.yml as its default input.[1:4]
The structure of a
docker-compose.yml file is said to be a declarative way of describing and running a containerized application (potentially consisting of more than a single container).[1:5]
This means we tell the Docker engine what the desired state for the application is and it has to figure out on its own how to achieve this desired state and how to reconcile it if the system deviates from it.[1:6]
Using Docker Compose 
- Define your app’s environment with a Dockerfile so it can be reproduced anywhere.
- Define the services that make up your app in
docker-compose.ymlso they can be run together in an isolated environment.
- Lastly, run
docker compose upand Compose will start and run your entire app.
A Compose file looks like this: [2:2]