Compose prefixes every volume it creates with the project name and happily removes it with down -v. For data that should outlive the project, mark the volume as external.
services:
app:
image: example/app:1.0
volumes:
- media:/media
volumes:
media:
external: true
name: shared-media
You create the volume yourself, once:
docker volume create shared-media
Compose now looks for shared-media as is, without a project prefix, and never creates or deletes it. Two projects can point at the same volume this way, and a careless docker compose down -v leaves it alone. The same external: true works for networks, which is how I would attach several stacks to one shared proxy network.
If the volume does not exist, Compose refuses to start the project with an error like external volume "shared-media" not found. That is a feature: you notice the missing data right away instead of getting a fresh empty volume. On a new machine, the create step has to be part of your setup notes or script.
Further reading: Compose file reference: volumes, Compose file reference: networks