Preface

This post assumes that you have some basic understanding of Docker, Docker Compose, and the key terms used in the ecosystem. Should you need to get up to speed, the “Get Started” section of Docker Docs is a great place to start.

This is part 2 of the 2-part series where we share about our experience experimenting with Docker to containerize applications here at Rate. In part 1, we talked about how we turned Docker containers into development machines. In this post, we will talk about how we leverage the strengths of Docker containers to run a multi-container application.

Motivations

At this point, we realised that Docker containers shouldn’t be used as dev machines but should instead be used as hosting machines. We still saw benefits in containerization, primarily as a way for developers to self-host applications easily. This allows developers to conduct integration tests independently, which we feel is a significant boost in productivity.

Hence, we proceeded to configure our applications as Compose services. The following text details the steps we took to build the Compose configuration.

Format

The Docker Compose Docs already does a great job of giving you a full run-through of how to set up multiple services in Compose. Instead of repeating what they have done, this post aims to be a concise instructional for any developer seeking to build a Compose config. We will focus on the key components you need to take note of.

The Building Blocks

Building a Compose config can be divided into the 6 main steps:

  1. Split your app into services
  2. Pull or build images
  3. Configure environment variables
  4. Configure networking
  5. Set up volumes
  6. Build & Run