Pcornel
Linux · Containers

Docker Compose

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

Back to the Topic

Answer

Docker Compose defines multi-container applications in a compose.yaml (services, networks, volumes, environment) and manages them with docker compose up/down/logs.

Remember

Services reach each other by service name on the project network. depends_on with healthchecks controls start order. Use .env for variables and keep secrets out of the file.

First checks

  • docker ps -a / podman ps -a — containers and state
  • docker logs <c> — container output
  • docker inspect <c> — configuration, mounts, network
  • docker info — engine, storage driver, cgroup version

Commands

docker compose up
docker compose pull && docker compose up -d
docker compose restart api
docker compose run --rm api migrate
docker compose down
docker compose down -v
docker compose config
docker inspect

Verify in this order

compose file → project network and volumes → services started in order → reachable by service name

Where it usually breaks

First mismatch in hardware/kernel capability → scheduler/mm/device → cgroup/namespace → process/thread → service/runtime → workload behavior/counters; preserve identity/native diagnostic/pre-state before mutation.

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

Confirmation

Confirm action

Continue?