Chapter 11. Declarative environments with Docker Compose

 

This chapter covers

  • Using Docker Compose
  • Manipulating environments and iterating on projects
  • Scaling services and cleaning up
  • Building declarative environments

Have you ever joined a team with an existing project and struggled to get your development environment set up or IDE configured? If someone asked you to provision a test environment for their project, could you enumerate all the questions you’d need to ask to get the job done? Can you imagine how painful it is for development teams and system administrators to resynchronize when environments change? All of these are common and high-effort tasks. They can be time-intensive while adding little value to a project. In the worst case, they give rise to policies or procedures that limit developer flexibility, slow the iteration cycle, and bring paths of least resistance to the forefront of technical decision making.

This chapter introduces you to Docker Compose (also called Compose) and how you can use it to solve these common problems.

11.1. Docker Compose: up and running on day one

Compose is a tool for defining, launching, and managing services, where a service is defined as one or more replicas of a Docker container. Services and systems of services are defined in YAML files (http://yaml.org) and managed with the command-line program docker-compose. With Compose you can use simple commands to accomplish these tasks:

11.2. Iterating within an environment

11.3. Starting a new project: Compose YAML in three samples

11.4. Summary