Linux Labs

Containers: Docker and compose / Stage 8 of 11

docker compose: a stack in one file

Not running Starting usually ~20 s
Leave the lesson

Step 7 of 7 · summary · 2 min

Summary

  • A stack is described in compose.yaml: a service is a container with docker run options, and the service name is a name in the project network.
  • docker compose ps shows the state of the services, logs <service> shows a log; the failed service writes the reason itself.
  • up -d re-creates the services whose description changed; restart restarts the same container — for mounted files.
  • down removes the project's containers and network and keeps the volumes; healthcheck marks a container (healthy) or (unhealthy).
  • The site answered 502 because backend kept restarting: compose.yaml had APP_MODE: prodution, and the application exited with code 1.
Ubuntu 24.04
Loading…