Why use Compose?


目录

Using Docker Compose offers several benefits that streamline the development, deployment, and management of containerized applications:

Common use cases of Docker Compose

Compose can be used in many different ways. Some common use cases are outlined below.

Development environments

When you're developing software, the ability to run an application in an isolated environment and interact with it is crucial. The Compose command line tool can be used to create the environment and interact with it.

The Compose file provides a way to document and configure all of the application's service dependencies (databases, queues, caches, web service APIs, etc). Using the Compose command line tool you can create and start one or more containers for each dependency with a single command (docker compose up).

Together, these features provide a convenient way for you to get started on a project. Compose can reduce a multi-page "developer getting started guide" to a single machine-readable Compose file and a few commands.

Automated testing environments

An important part of any Continuous Deployment or Continuous Integration process is the automated test suite. Automated end-to-end testing requires an environment in which to run tests. Compose provides a convenient way to create and destroy isolated testing environments for your test suite. By defining the full environment in a Compose file, you can create and destroy these environments in just a few commands:

$ docker compose up -d
$ ./run_tests
$ docker compose down

Single host deployments

Compose supports production deployments on single hosts. You can use Compose to deploy applications to remote Docker hosts and manage production-specific configurations.

For details on using production-oriented features, see Compose in production.

What's next?


版本号 #2
由 壳壳虫 创建于 2026-10-31 19:09:17 UTC
由 壳壳虫 更新于 2026-10-31 19:09:18 UTC