Docker tutorial: Get started with Docker Compose

Learn how to use Docker’s native service configuration and deployment tool for testing and debugging multi-container apps

Docker tutorial: Get started with Docker Compose

Containers are meant to provide component isolation in a modern software stack. Put your database in one container, your web application in another, and they can all be scaled, managed, restarted, and swapped out independently. But developing and testing a multi-container application isn’t anything like working with a single container at a time.

Docker Compose was created by Docker to simplify the process of developing and testing multi-container applications. It’s a command-line tool, reminiscent of the Docker client, that takes in a specially formatted descriptor file to assemble applications out of multiple containers and run them in concert on a single host. (Tools like Docker Swarm or Kubernetes deploy multi-container apps in production across multiple hosts.)

In this tutorial, we’ll walk through the steps needed to define and deploy a simple multi-container web service app. While Docker Compose is normally used for development and testing, it can also be used for deploying production applications. For the sake of this discussion, we will concentrate on dev-and-test scenarios.

Docker Compose example

A minimal Docker Compose application consists of three components:

To continue reading this article register now