Skip to content
Ameen Abozaid
Planned lessonJNR-050-L01

Compose files

  • Lesson 1 of 5
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

describe a multi-service environment in one file.

Planned topics

  • Compose runs several containers together from compose.yaml; one command starts or stops them all.
  • Each entry under services: is a container: image or build, ports, environment, volumes.
  • Compose creates a network for the project; services reach each other by service name.
  • Named volumes go under volumes:.
  • Commands: docker compose up -d, ps, logs -f, down (add -v to delete volumes).
Draft outline details

Demonstration

yaml
services:
  db:
    image: postgres:16
    environment:
      POSTGRES_PASSWORD: dev
    volumes: [pgdata:/var/lib/postgresql/data]
  app:
    build: .
    ports: ["8080:8080"]
volumes:
  pgdata:

Check your understanding

What does docker compose down -v do beyond down?

Show answer

It also deletes the named volumes and their data.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.