Ram

Lesson 5 of 6

Docker Compose

Run multiple services from one declarative configuration.

Introduction

Compose is useful when an application needs several cooperating services such as a web app and database.

A compose file documents service images, build contexts, ports, volumes, networks and environment values.

Key insight

Run multiple services from one declarative configuration.

Example

services:
  web:
    build: .
    ports:
      - "3000:3000"
  db:
    image: postgres:17

Read the example line by line, then try changing one value.

Real-world example

Docker Compose helps developers build useful applications.

Practice challenge

Add a named volume to the database service in your own practice file.

Previous
Next