# docker compose down Command Reference

> Reference for docker compose down in CI: stop and remove containers, networks, and with -v the volumes, to tear down a stack cleanly after pipeline tests.

Source: https://latchkey.dev/learn/command-reference/docker-compose-down-command-reference  
Updated: 2026-06-26

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.

## FAQ

### 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.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
