Pcornel
Containers · Docker & Compose Operations

Docker Compose Basics

Cheat sheet · https://pcornel.dk/topic.php?topic=6137

Back to the Topic

Answer

Docker Compose defines services, networks and volumes in compose.yaml and runs them together with docker compose.

Remember

Services resolve each other by name. Use .env for variables and depends_on with healthchecks. docker compose config shows the merged result.

First checks

  • docker compose config — merged configuration
  • docker ps -a — containers and exit codes
  • docker logs <c> — container output
  • docker inspect <c> — config, mounts, network, state

Commands

docker compose up -d
docker compose ps
docker compose logs -f api
docker compose down
docker compose config

Verify in this order

compose.yaml → network + volumes → services

Where it usually breaks

depends_on without a health condition only orders startup; it does not wait for readiness.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6137

Confirmation

Confirm action

Continue?