Difficulty: Beginner
Estimated Time: 10 minutes

When working with multiple containers, it can be difficult to manage the starting along with the configuration of variables and links. To solve this problem, Docker has a tool called Docker Compose to manage the orchestration, of launching, of containers.

This environment has the latest Docker Compose installed. Visit https://docs.docker.com/compose/install/ for instructions on how to install this into your local environment.

In this scenario we explored how you can use Docker Compose to manage the orchestration of multi-container applications.

Don’t stop now! The next scenario will take about 20 minutes to complete. You can pause and come back at any time.

Orchestration using Docker Compose

Step 1 of 7

Step 1 - Defining First Container

Docker Compose is based on a docker-compose.yml file. This file defines all of the containers and settings you need to launch your set of clusters. The properties map onto how you use the docker run commands, however, are now stored in source control and shared along with your code.

The format of the file is based on YAML (Yet Another Markup Language).

  property: value
    - or options

Task: Defining First Container

In this scenario, we have a Node.js application which requires connecting to Redis. To start, we need to define our docker-compose.yml file to launch the Node.js application.

Given the format above, the file needs to name the container 'web' and set the build property to the current directory. We'll cover the other properties in future steps.

Copy the following yaml into the editor. This will define a container called web, which is based on the build of the current directory.

  build: .