talira

Docker Compose

Define and run multi-container applications with Docker

open sourceApache-2.0self-hostablefree

Docker Compose defines a multi-container application in one YAML file (compose.yaml): its services, networks, volumes, secrets and configs, following the open Compose Specification. docker compose up then creates and starts everything on a Docker Engine, and other commands rebuild, watch for file changes, stream logs, run one-off commands and tear the stack down. Today's Compose is a Go plugin for the docker CLI (Compose v2, and v5, which adds an official Go SDK); the original Python docker-compose (v1) is retired. It comes with Docker Desktop and as a Linux package from Docker's repositories, and Compose Bridge turns a Compose file into Kubernetes manifests.

Ways to install

Problems it solves

  • start my app with its Postgres and Redis on my laptop with one command
  • describe every service, network and volume of a multi-container app in one file kept in the repo
  • new developers lose a day setting up local dependencies; one file should bring them all up
  • spin up an isolated environment for integration tests in CI and destroy it when the tests finish
  • rebuild or resync my containers automatically when I save source files during development
  • run optional services like an admin UI or a mail catcher only when I ask for them
  • override a few settings for production without copying the whole container setup
  • make the web container wait until the database passes its health check before starting
  • deploy a small multi-container app to a single server without learning Kubernetes
  • turn my local multi-container setup into Kubernetes manifests and a Kustomize overlay
  • load, validate and start multi-container projects from my own Go program instead of calling the CLI
  • give containers secrets as files instead of putting passwords in environment variables
  • give a containerized service access to the host's NVIDIA GPU
  • run a one-off command such as a database migration inside one service's container
  • follow the logs of every container in my stack in one terminal

View all 17 problems

Features

  • compose.yaml following the open Compose Specification
  • docker compose commands to start, stop, rebuild, check status, stream logs and run one-off commands
  • Compose Watch: sync or rebuild services when files change
  • profiles for optional services
  • multiple Compose files combined with merge, include and extends
  • startup order with depends_on and health checks
  • secrets and configs mounted as files
  • GPU access for services
  • publish a Compose application to an OCI registry
  • variables and .env files for per-environment values
View 4 more
  • deploy to a remote Docker host with DOCKER_HOST
  • Compose Bridge: converts Compose files to Kubernetes manifests and a Kustomize overlay, with custom transformation templates
  • Go SDK (Compose v5) for loading, validating and running Compose projects from code
  • ships in Docker Desktop, as the docker-compose-plugin Linux package, and as standalone binaries

Limitations

  • Doesn't run Compose file format 1: files without a top-level services key worked only with the old Python Compose v14

Capabilities

Has a command line toolplan not known
Has official SDKsplan not known

Alternatives

The same job

These do what Docker Compose does.

  1. devenv Declarative, reproducible developer environments using Nix
  2. podman-compose A script to run docker-compose.yml using podman
  3. Tilt Smart rebuilds and live updates for microservice development on Kubernetes
  4. Aspire Compose distributed apps in code

Compare Docker Compose with the top 3