Skip to content
LatchkeyLatchkey home

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.

Frequently asked questions

docker compose down Command Reference?
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.
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.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card