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-orphansIn 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
docker compose up Command ReferenceReference for docker compose up in CI: start services from a compose file with -d, --build, and --wait so dep…
docker volume Command ReferenceReference for docker volume in CI: create, list, inspect, remove, and prune named volumes for persisting or s…
docker compose ps Command ReferenceReference for docker compose ps in CI: list the status of project services with -a, --format, and --status to…