Favicon of Docker Compose

Docker Compose

Docker Compose lets you define multi-container Docker applications in a Compose file and start them with one command.

Docker Compose website screenshot
Docker Compose GitHub repository preview

Docker Compose is a CLI tool and Docker plugin for defining and running multi-container applications. You describe services, networks, and volumes in a compose.yaml file (following the Compose Specification), then bring the whole stack up or down with a single command. It's built for developers and ops engineers who run more than one container together, whether that's an app plus a database, a set of microservices, or a local dev environment that mirrors production.

Instead of running several docker run commands with long option lists, you write one file that captures build instructions, ports, volumes, and dependencies between services. Compose reads that file and handles creating the containers, networks, and volumes needed to run them together.

Key features

  • Declarative Compose files: define services, networks, and volumes in YAML using the open Compose Specification.
  • Single-command lifecycle: docker compose up builds, creates, and starts everything defined in the file; docker compose down tears it down.
  • Multi-service orchestration: link services together (e.g., a web app and a Redis cache) with shared networking configured automatically.
  • Build or pull images: services can reference a Dockerfile to build locally or an existing image from a registry.
  • Go-based CLI plugin: implemented in Go and distributed as a Docker CLI plugin (docker compose), replacing the older Python docker-compose binary.
  • Cross-platform availability: bundled with Docker Desktop on Windows and macOS, or installed as a CLI plugin on Linux.

Ideal use cases

Compose fits local development environments where you need a database, cache, and app server running together without manually wiring up networking each time. It's also useful for CI pipelines that spin up dependent services for integration tests, and for small deployments where a single host runs a fixed set of containers.

It's a good fit if you want a reproducible, version-controlled definition of your app's runtime environment that any teammate can start with one command.

It's not the right tool for multi-host orchestration or production-grade scheduling with autoscaling, rolling updates across a cluster, or self-healing at scale. For that you want Kubernetes or a similar orchestrator. It's also not a substitute for Docker Swarm-specific features; the README notes Swarm relies on a legacy compose format and, since Swarm is no longer maintained by Docker Inc. following its acquisition by Mirantis, some newer Compose syntax isn't available to Swarm users.

Installation

On Windows and macOS, Docker Compose ships with Docker Desktop, so no separate install is needed.

On Linux, download the binary for your platform from the project's release page, then install it as a CLI plugin:

# Rename the downloaded binary and place it in your user's plugin directory
mv docker-compose-linux-x86_64 ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose

To install system-wide instead, copy the renamed, executable binary into one of:

/usr/local/lib/docker/cli-plugins
/usr/local/libexec/docker/cli-plugins
/usr/lib/docker/cli-plugins
/usr/libexec/docker/cli-plugins

Once installed, define your app in a compose.yaml file, for example:

services:
  web:
    build: .
    ports:
      - "5000:5000"
    volumes:
      - .:/code
  redis:
    image: redis

Then start it with:

docker compose up

Compose builds the web service from the local Dockerfile, pulls the redis image, and starts both containers connected on a shared network.

Frequently asked questions

Share:

Stars
38.1K
Forks
5.8K
Last commit
16 hours ago
Repository age
13 years
License
Apache-2.0
Self-hosted
No
Activity score
86/100
View Repository
Ad
Favicon

 

  
 

Similar to Docker Compose

Favicon

 

  
 
Favicon

 

  
 
Favicon