docker-compose

docker-compose

Instead of running multiple containers…

…declare a whole stack of services

Services are described in a declarative manner

Modifications are applied incrementally

Service discovery is builtin

Based on independent compose specification

Example

WordPress requires a database, e.g. MySQL

docker-compose.yaml defines both services:

services:
  db:
    image: mysql:5
  web:
    image: wordpress:5.4

Both services need matching database configuration provided by environment variables

Deploy using docker-compose:

docker-compose up

Remove deployment:

docker-compose down

docker-compose vs. docker compose

Both flavours shipped with Docker Desktop

docker-compose 1.x

Implemented in Python

Install using pip: pip install docker-compose

Install standalone binary from GitHub releases

Usage: docker-compose

docker compose 2.x (beta)

Implemented in Go

Install and update using install script

Usage: docker compose