Aanand Prasad

Announcing Docker Compose

Today we’re excited to announce that Docker Compose is available for download. Docker Compose is an orchestration tool that makes spinning up multi-container applications effortless. Head to the install docs to download it.

With Compose, you define your application’s components – their containers, their configuration, links, volumes, and so on – in a single file, then you can spin everything up with a single command that does everything that needs to be done to get your application running.

If you’ve used Fig before, this will sound familiar – in fact, Compose is based directly on the Fig codebase and is backwards-compatible with Fig applications. Fig’s been hugely successful as a tool for development environments, with almost 5,000 stars on GitHub, 80,000 downloads, and users including Yelp, Spotify, Mozilla, Facebook and the UK Government. Fig will continue to receive critical maintenance updates, but is now deprecated in favour of Compose – check the release notes for how to upgrade (spoiler: it’s very simple).

Using Compose is a three-step process, which is best explained with a short example. First, you define your app’s environment with a Dockerfile so it can run anywhere:

FROM python:2.7
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code
CMD python app.py

Next, you define the components that make up your app in docker-compose.yml so they can be run together in an isolated environment:

web:
  build: .
  links:
    - redis
  ports:
    - "5000:5000"
redis:
  image: redis

Lastly, run docker-compose up and Compose will start and run your entire app, determining the right order to start everything in, and building and pulling any images as necessary. Here’s a screencast showing it in action:

 


You can find the full version of this tutorial in the Compose docs.

Compose has commands for managing the whole lifecycle of your application:

  • Start, stop, and rebuild services
  • View the status of running services
  • Stream the log output of running services
  • Run a one-off command on a service

We’ve got a lot planned for Compose – check out the roadmap to get an idea of where we’re taking it. In particular, we plan to make Compose integrate smoothly with Docker Swarm, so you can let Swarm intelligently schedule your containers across a multi-host cluster while using Compose to manage them at the application level. For now, there’s a small and experimental amount of integration – check the integration notes if you want to try it out.

Head over to the install docs to download Compose and check out the quick start guide to take it for a spin. If you have any questions, drop in to #docker-compose on IRC; report any bugs on GitHub.

This release of Compose includes work from many wonderful contributors. Special thanks goes out to dnephin, squebe, jbalonso, raulcd, benlangfeld and albers.

 

Learn More about Compose

Learn More about Docker

, , , , , ,

Aanand Prasad

Announcing Docker Compose


Leave a Reply

Get the Latest Docker News by Email

Docker Weekly is a newsletter with the latest content on Docker and the agenda for the upcoming weeks.