Skip to content
Latchkey

docker compose down Command Reference

Stop and remove the services, networks, and optionally volumes.

docker compose down is the teardown counterpart to up: it stops and removes the containers and the default network for the project. With -v it also removes named volumes declared in the compose file, giving a clean slate for the next run.

Common flags

  • -v, --volumes - also remove named volumes declared in the file
  • --rmi - remove images, e.g. --rmi local or --rmi all
  • --remove-orphans - remove containers for services no longer in the file
  • -t, --timeout - shutdown timeout in seconds before kill

Example

shell
docker compose down -v --remove-orphans

In CI

Run docker compose down -v in an always() cleanup step so volumes (database data, caches) do not leak into the next job on a persistent runner. --remove-orphans clears containers left by a previous compose file revision. On ephemeral runners the teardown matters less but is still good hygiene.

Key takeaways

  • -v removes named volumes for a truly clean teardown between runs.
  • --remove-orphans clears containers left over from an older compose file.
  • Run it in an always() step so failed jobs still clean up.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →