Help us shape the future of Go! Take the 2026 Go Developer Survey

compose

module
v5.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: Apache-2.0

README

Table of Contents

Docker Compose

GitHub release PkgGoDev Build Status Codecov OpenSSF Scorecard Docker Compose

Docker Compose is a tool for running multi-container applications on Docker defined using the Compose file format. A Compose file is used to define how one or more containers that make up your application are configured. Once you have a Compose file, you can create and start your application with a single command: docker compose up.

Note: About Docker Swarm Docker Swarm used to rely on the legacy compose file format but did not adopt the compose specification so is missing some of the recent enhancements in the compose syntax. After acquisition by Mirantis swarm isn't maintained by Docker Inc, and as such some Docker Compose features aren't accessible to swarm users.

Where to get Docker Compose

Windows and macOS

Docker Compose is included in Docker Desktop for Windows and macOS.

Linux

You can download Docker Compose binaries from the release page on this repository.

Rename the relevant binary for your OS to docker-compose and copy it to $HOME/.docker/cli-plugins

Or copy it into one of these folders to install it system-wide:

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

(might require making the downloaded file executable with chmod +x)

Quick Start

Using Docker Compose is a three-step process:

  1. Define your app's environment with a Dockerfile so it can be reproduced anywhere.
  2. Define the services that make up your app in compose.yaml so they can be run together in an isolated environment.
  3. Lastly, run docker compose up and Compose will start and run your entire app.

A Compose file looks like this:

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

Contributing

Want to help develop Docker Compose? Check out our contributing documentation.

If you find an issue, please report it on the issue tracker.

Legacy

The Python version of Compose is available under the v1 branch.

Directories

Path Synopsis
cmd
prompt
Package prompt is a generated GoMock package.
Package prompt is a generated GoMock package.
docs
examples command
examples/sdk command
yaml/main command
concurrency
Package concurrency holds the helpers Compose uses to bound how many operations run at once, driven by the --parallel setting.
Package concurrency holds the helpers Compose uses to bound how many operations run at once, driven by the --parallel setting.
confighash
Package confighash computes the configuration hashes that Compose stamps on the containers, networks and volumes it creates, and compares against on the next run to detect a configuration change.
Package confighash computes the configuration hashes that Compose stamps on the containers, networks and volumes it creates, and compares against on the next run to detect a configuration change.
containerops
Package containerops implements the operations that act from the outside on the container of a service: exec, cp, export and commit.
Package containerops implements the operations that act from the outside on the container of a service: exec, cp, export and commit.
engine
Package engine describes what the operations extracted out of pkg/compose need from the engine they run against, so that they all state it the same way.
Package engine describes what the operations extracted out of pkg/compose need from the engine they run against, so that they all state it the same way.
inspect
Package inspect implements the read-only operations that report on a project and its resources: ps, ls, top, port, volumes, events and viz.
Package inspect implements the read-only operations that report on a project and its resources: ps, ls, top, port, volumes, events and viz.
naming
Package naming derives the names Compose uses for the Docker resources it manages.
Package naming derives the names Compose uses for the Docker resources it manages.
oci
pidfile
Package pidfile provides helper functions to create and remove PID files.
Package pidfile provides helper functions to create and remove PID files.
progress
Package progress builds the progress events Compose reports while it operates on resources.
Package progress builds the progress events Compose reports while it operates on resources.
projectloader
Package projectloader obtains a Compose project: either by loading and validating the Compose files (LoadProject), or by generating one from existing containers (Generate).
Package projectloader obtains a Compose project: either by loading and validating the Compose files (LoadProject), or by generating one from existing containers (Generate).
provider
Package provider runs the provider plugins that manage the services declared with a provider, and speaks the JSON message protocol they use to publish variables and endpoints, and to ask Compose for the service configuration, the relay information or an image.
Package provider runs the provider plugins that manage the services declared with a provider, and speaks the JSON message protocol they use to publish variables and endpoints, and to ask Compose for the service configuration, the relay information or an image.
pkg
api
e2e
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL