Docker Compose Down -v (Volumes): What It Deletes (and Safe Reset Recipes)

If you’ve ever run docker compose down -v and then found an empty database, that’s the -v flag. It removes named volumes created by the project — and that’s where your data usually lives.

Common trap: down -v is data-destructive for stacks that store state in named volumes (Postgres/MySQL/Redis).

TL;DR

  • docker compose down removes containers + the default network for the project.
  • docker compose down -v also removes named volumes created by the project (data loss risk).
  • If you want a reset without deleting DB data, use docker compose stop, or down without -v.

What docker compose down -v actually removes

At a high level, Compose “down” targets one project (based on directory name or -p project name). The -v / --volumes flag extends that cleanup to the project’s named volumes.

docker compose down
docker compose down -v
docker compose down --volumes

Safe reset recipes (copy/paste)

Use these when you want a clean slate without guessing what will be deleted.

1) Remove containers + network, keep volumes (safest default)

docker compose down

2) Remove containers, keep volumes, but restart fresh

docker compose down
docker compose up -d

Related: if you’re not sure what up recreates (and when), see Docker Compose Up: flags + troubleshooting.

3) Full wipe: containers + volumes (data-destructive)

docker compose down -v

If you’re doing this intentionally, consider backing up volumes first (for example, dump your DB) and double-check you’re in the right project directory.

Common mistakes (and fixes)

  • Ran down -v in the wrong folder: use docker compose ls to see projects and use -p explicitly.
  • Expected down to remove volumes: it won’t unless you add -v.
  • Confused by external volumes: volumes marked external: true are not removed by Compose.

FAQ

Does `docker compose down -v` delete my database data?

Yes, if your database uses a named volume (the common case). down -v removes named volumes created by the project. If you want a “reset” without losing DB data, use docker compose stop (or down without -v).

What’s the difference between `docker compose down` and `docker system prune`?

down targets one Compose project (containers + default network; optionally volumes/images). system prune is global cleanup and can remove resources unrelated to your project.

How do I remove containers but keep volumes?

Use docker compose down without -v. To remove containers but keep data, avoid --volumes / -v.

Does `docker compose down` remove images?

Not by default. Use docker compose down --rmi local to remove images built by the project, or --rmi all to remove all images used by the services.

Why do my volumes remain after `down`?

Because named volumes are intentionally preserved unless you explicitly add -v. Also, external volumes (declared as external: true) are not removed by Compose.

Related reading

Sergio Bremming Avatar