Skip to main content

Creating multi-container applications just got much easier, with the advent of Docker Compose.
With Compose, you can define all components of an application, including containers, configurations, links and volumes, in a single file. Once that file is created, you can use a single command to do everything needed to get your application running.

Compose is a reboot of the Fig codebase, a successful tool for development environments that has nearly 5,000 stars on GitHub, 80,000 downloads, and users including Yelp, Spotify, Mozilla, Facebook and the UK government.
Compose is backwards-compatible with Fig, which will continue to receive critical updates for the time being. Those who have been using Fig are encouraged to upgrade to Compose, as Fig is deprecated in favour of Compose.

Once you download Compose, there are three steps to get up and running:
First, define your app’s environment with a Dockerfile, allowing it to run anywhere; second, define the components of your app in `docker-compose.yml`, allowing the components to run together in an isolated environment; and finally, run `docker-compose up`. 

From there, Compose will start and run the entire app, determining the proper order in which to run elements, and building and pulling images as needed.

Compose has commands for managing the entire lifecycle of an application, such as `start`, `stop`, and `rebuild` services. With compose, you can *view the status* of running services, *stream the log output* of running services and run a one-off command on a service.

### The Docker Compose system holds some improvements over Fig.

Docker-compose run has a `–service-ports` flag for exposing ports on a service, which is useful for running a webapp with an interactive debugger; users can link to containers outside their apps with the `external_links` option in `docker-compose.yml`; and Compose can be prevented from automatically building images with the `–no-build` option, creating fewer API calls and running faster.

Other improvements to Compose include:

* Support of the `-s` flag, allowing users to specify an exact signal to send to a service’s containers;
* An `env_file` key, analogous to docker run `–env-file`, letting users specify multiple environment variables in a separate file, which is helpful for apps a lot of variables, or for keeping sensitive information out of version control;
* Support of the `dns_search`, `cap_add`, `cap_drop`, `cpu_shares` and restart options, analogous to docker run’s `–dns-search`, `–cap-add`, `–cap-drop`, `–cpu-shares` and `–restart` options
* Shipment with Bash tab completion.

Moving forward, plans are in place to integrate Compose with Docker Swarm.
With that, Swarm would schedule your containers intelligently across a multi-host cluster while Compose would manage them at the application level.

To see what Compose has to offer, visit [install docs]( to download Compose and view the [quick start guide]( to get Compose up and running quickly. You can take any questions to [#docker-compose]( on [IRC]( and report any bugs on [GitHub](

Daniel Sachse

Author Daniel Sachse

More posts by Daniel Sachse