Introduction to Docker Compose

This lesson gives an overview of Docker Compose.

We'll cover the following

In this chapter, we’ll look at how to deploy multi-container applications using Docker Compose.

Docker Compose and Docker Stacks are very similar. In this chapter, we’ll focus on Docker Compose. Docker Compose deploys and manages multi-container applications on Docker nodes running in single-engine mode. In the Deploying Applications with Docker Stacks Chapter, we’ll focus on Docker Stacks. Stacks deploy and manage multi-container apps on Docker nodes running in swarm mode.

Overview

Modern cloud-native apps are made of multiple smaller services that interact to form a useful app. We call this pattern “microservices”. A simple example might be an app with the following seven services:

  • Web front-end
  • Ordering
  • Catalog
  • Back-end database
  • Logging
  • Authentication
  • Authorization

Get all of these working together, and you have a useful application.

Deploying and managing lots of small microservices like these can be hard. This is where Docker Compose comes into play.

Instead of gluing each microservice together with scripts and long docker commands, Docker Compose lets you describe an entire app in a single declarative configuration file, and deploy it with a single command.

Once the app is deployed, you can manage its entire lifecycle with a simple set of commands. You can even store and manage the configuration file in a version control system.

That’s the basics. Let’s dig deeper.