Ram

Lesson 5 of 6

Docker Compose

Run multiple services from one declarative configuration.

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.

Example

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

Practice challenge

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

Previous
Next